On Sunday, October 2, 2016 at 7:01:59 PM UTC-7,
lawren...@gmail.com wrote:
>Subject: Does Anyone Still Use Backticks?
> Instead of
> cmd1 ... `cmd2 ... ` ...
> use
> cmd1 ... $(cmd2 ... ) ...
Yes, certainly sometimes.
E.g. in simple non-nested short(ish) command,
also for (extreme) backwards compatibility,
and also sometimes to avoid drain bamaged bash(1) bug.
So, e.g., very simple non-nested:
hostname=`hostname`
bit less typing, quite clear enough, highly backwards compatible
but lacks matched pairing.
Got nasty bash bug?
For many bash versions (I still sometimes hit such on production
systems), an intermix of case statements using ) rather than () pairs
in case, along with $() command substitution, runs into a nasty
bug in bash. Using `` instead of $() avoids that bug.
Other work-around for that bug is use newer alternative case
syntax that allows for matched () in case pattern matching.
And, if one needs much backwards compatibility or relatively extreme
portability, using backticks is highly reliable in that regard.
So, yes, I do still use backticks for command substitution, ... though
I do also use $(). Which I'll use, quite depends on context.