2008-08-11 01:24:17

Remove the last character from a string/variable (bash)

echo ${var:0:${#var}-1}
echo ${var%?}
echo $var | sed 's/.$//'

You could also use chop ;)


Posted by haui | Permanent Link | Categories: linux