CHAPTER 9 Shell Programming
$varman
but this doesn't work, because the shell will be trying to evaluate a variable called varman, which doesn't exist. To get the desired result we need to separate it by quoting, or by isolating the variable with curly braces ({}), as in:
"$var"man - quote the variable
$var""man - separate the parameters
$var"man" - quote the constant
$var''man - separate the parameters
$var'man' - quote the constant
$var\man - separate the parameters
${var}man - isolate the variable
These all work because ", ', \, {, and } are not valid characters in a variable name.
We could not use either of
'$var'man
\$varman
because it would prevent the variable substitution from taking place.
When using the curly braces they should surround the variable only, and not include the $, otherwise, they will be included as part of the resulting string, e.g.:
% echo {$var}man
{bat}man