What's the difference between
failed_instance=`aws deploy`
and
failed_instance=$(aws deploy)
I'm talking about ` and $(?
What's the difference between
failed_instance=`aws deploy`
and
failed_instance=$(aws deploy)
I'm talking about ` and $(?
Both are semantically identical, and both are mandated by the POSIX sh standard, but $()
is the newer, modern syntax.
$()
, but backslashes require escaping (lots of escaping if nesting) inside backticks.It nests cleanly. Compare
printf '%s\n' "$(foo "$(bar)")" # new POSIX sh syntax
to its old-style equivalent...
printf '%s\n' "`foo \"\`bar\`\"`" # legacy Bourne syntax