I have written the following lines to get the last character of a string:
str=$1 i=$((${#str}-1)) echo ${str:$i:1}
It works for abcd/
abcd/
another solution using awk script:
last 1 char:
echo $str | awk '{print substr($0,length,1)}'
last 5 chars:
echo $str | awk '{print substr($0,length-5,5)}'