Shell variable substitutions within single quotes

3 06 2014

You want single quotes AND variable substitutions? Surely you can’t be serious!

I am serious. And don’t call me Shirley.

In short, put double quotes around the single quotes.

> STUFF=things
> echo $STUFF
things
> echo "$STUFF"
things
> echo '$STUFF'
$STUFF
> echo "'$STUFF'"
'things'

Via this guy.








Skip to toolbar