Frequently Asked Question
What is the difference between $(...) and backticks?
Both forms are command substitution: they run a command and replace the construct with
its standard output. today=$(date +%Y-%m-%d) and today=`date +%Y-%m-%d` produce
the same result. The dollar-parenthesis form is newer (POSIX, from the late 1980s);
backticks are the original Bourne shell syntax, kept for compatibility.
Prefer $( ... )` for two reasons. First, it nests cleanly: `$(echo "$(date)") reads
naturally, whereas backticks require escaping inner backticks with backslashes that
multiply with each level. Second, the quoting rules inside $() are saner, what you
see is what you get, while inside backticks, backslashes have to do double duty for
both the backtick parser and the shell. Modern style guides (Google's, the Bash Hackers
Wiki, ShellCheck) all recommend $(). Backticks remain valid and you will still see
them in older scripts, but write new code in dollar-parens.