$(...)
notation instead of legacy backticked
`...`
.echo "You are running on `uname`"
echo "You are running on $(uname)"
Backtick command substitution `...`
is legacy syntax
with several issues.
$(...)
command substitution has none of these problems,
and is therefore strongly encouraged.
Note: The $(...)
syntax was introduced in the 1989 Korn
Shell (ksh). Finally, in 2011, Solaris 11 was the last operating system
to switch from the Bourne Shell to the Korn Shell. After 2011, all
typical shells have supported the POSIX $(...)
notation.
$(...)
and might require the use of backtick command
substitution. See [mc-devel]
[PATCH] Prefer $() to backticks in sh script and follow-ups.$(...)
preferred over `...`
(backticks)?`command`
in
shell programming?ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.