When bashing, I know that double quoting is sometimes necessary if an environment variable (EV) contains embedded spaces. Example: "$JACK" rather than $JACK. Sometimes it is recommended to use the syntax borrowed from substringing if the identifier of the EV is ambiguous. Example, because the EV is not $JACKA, $JACKAN, nor $JACKAND we would use curly braces with no substring indices to write ${JACK}ANDJILL.
It seems that double quotes can accomplish the same thing. Example: "$JACK"ANDJILL
In fact if we do nothing but echo the following demonstrates equivalence.
#!/bin/bash
TEXAS="asdf asdf"
FLORIDA="qwer""$TEXAS""qwer" # use quotes
echo $FLORIDA
ALABAMA="qwer"${TEXAS}"qwer" # use substring without indices
echo $ALABAMA
ARIZONA="qwer""${TEXAS}""qwer" # use both
echo $ARIZONA
MAINE="qwer"$TEXAS"qwer" # use neither
echo $MAINE
NEVADA="qwer""$TEXAS"qwer # last bit not quoted
echo $NEVADA
IDAHO="qwer"${TEXAS}qwer # last bit not quoted
echo $IDAHO
The output:
qwerasdf asdfqwer
qwerasdf asdfqwer
qwerasdf asdfqwer
qwerasdf asdfqwer
qwerasdf asdfqwer
qwerasdf asdfqwer
Are there bash statements/constructs where the substring trick cannot be substituted with double quotes?
