With `bash` 4.2 and above, you can do: ${var::-1} Example: $ a=123 $ echo "${a::-1}" 12