4 ms·
1. They're mixing a Bourne-ism (backquotes) with a Bash-ism (dollar-parens). I don't know why. 2. This could be an attempt to normalize and reduce whitespace,
by neilv 7y ago
1. They're mixing a Bourne-ism (backquotes) with a Bash-ism (dollar-parens). I don't know why.
2. This could be an attempt to normalize and reduce whitespace, including eliminating newlines (though you should prevent injection of arguments to `echo`):
bash$ Temp=$(echo " a b c ")
bash$ echo "[${Temp}]"
[ a b c ]
bash$ Temp=`echo $(echo " a b c ")`
bash$ echo "[${Temp}]"
[a b c]
bash$ Temp=$(echo $(echo " a b c "))
bash$ echo "[${Temp}]"
[a b c]
- nils-m-holm 7y agoThe Bourne shell had $() before it had backquote. It's not a Bash-ism.
- neilv 7y agoThank you, I was mistaken to call it a Bash-ism. Bash's documentation said it's a Posix-ism: > The POSIX $() form of command substitution is implemented (see Command Substitution), and preferred to the Bourne shell’s `` (which is also implemented for backwards compatibility). https://www.gnu.org/software/bash/manual/html_node/Major-Differences-From-The-Bourne-Shell.html https://www.gnu.org/software/bash/manual/html_node/Major-Dif...