A contrived example... given
FOO=\"/foo/bar/baz\"
this works (in bash)
BAR=$(basename $FOO) # result is BAR=\"baz\" BAZ=${BAR
It fails because ${BAR:0:1} is a variable expansion. Bash expects to see a variable name after ${, not a value.
${BAR:0:1}
${
I'm not aware of a way to do it in a single expression.