$ basename /usr/bin/find find
file=test.txt b=${file%.*} echo $b
$ for file in *.JPG;do mv $file ${file%.*}.jpg;done
file=test.txt b=${file##*.} echo $b