Trim last 3 characters of a line using the bash shell. root# line=123abc root# line2=${line%%???} root# echo $line2 root# 123