Bash & Shell Scripting (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is the difference between Command Substitution `$(command)` and Backticks `` `command` ``?
junior Levelbash-shellBasic
In Simple Words: Both execute a shell command and capture its standard output:
$(command)(Modern Standard): Readable, supports clean arbitrary nesting without escaping:parent_dir=$(dirname $(realpath "$0"))- Backticks
`command`(Legacy): Difficult to read and requires awkward escaping when nesting:parent_dir=\dirname `realpath "$0"```