get substring from string variable

Hi Dears,

How to use variable in string location of expression ${string:index:length} to get substring from string?

I encounter error "bad substitution" when I use expression ${$var:0:5} to get first 5 characters from $var.

Could you please help me out of this? Thanks!

 
${var:0:5}
$ var="TESTING"

$ echo ${var:0:5}
TESTI

I know this is an old post, but here is a cheat sheet on string operations for future searchers: Reference Cards