Consider the following two scripts:
a=`ls -l`
a=$(ls -l)
This is a common use case for me, and I basically use both options interchangeably. Is there any difference? In which use case would you use one or another?
Consider the following two scripts:
a=`ls -l`
a=$(ls -l)
This is a common use case for me, and I basically use both options interchangeably. Is there any difference? In which use case would you use one or another?
The backquote (`) is used in the old-style command substitution, e.g.
foo=`command`
The
foo=$(command)
syntax is recommended instead. Backslash handling inside $() is less surprising, and $() is easier to nest. See http://mywiki.wooledge.org/BashFAQ/082