Say there are different files,script.shtext.txtpic_1.pngor files with no extension - 'hello'.How can you extract the last character of base file name?ie,script. sh - ttext.txt -  tpic_1.png - phello - oIs there like a simple way to do it?
Finding last character of base file name
shell script
First of all, you remove the extension if any:  name_no_ext=${file%.*}  then, you get the last char:   char=${name_no_ext: -1} #note the space after colon  If you want to learn more about string manipulation in bash, go to section Parameter Expansion of the bash manual.  