If this is Bash, Your first attempt should have worked:lastChar=${myStr:(-1)}Another option is to add a space after the colon:lastChar=${myStr: -1}If you are using some other shell other than Bash, this probably will not work, and you may need to pipe your variable through cut or some other program. --------------http://www.tldp.org/LDP/intro-linux/html/index.html