Interview Prep/Shell Scripting/Shells, scripts and execution

What is the difference between `$(command)` and backticks?

BeginnerConceptShells, scripts and execution
Answer

Both are command substitution: run the command and substitute its stdout, with trailing newlines removed. $( ) nests cleanly and handles backslashes predictably; backticks need escaping to nest and are hard to read.

release=$(basename "$(readlink -f /srv/app/current)")

Always use $( ) and quote it: "$(cmd)".

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Shells, scripts and execution