Bird
0
0

Why is the $() syntax preferred over backticks (`) for command substitution in modern bash scripting?

hard🧠 Conceptual Q10 of 15
Bash Scripting - Quoting and Expansion
Why is the $() syntax preferred over backticks (`) for command substitution in modern bash scripting?
ABecause $() runs commands faster
BBecause backticks are deprecated and no longer work
CBecause $() allows easier nesting of commands
DBecause backticks cause syntax errors always
Step-by-Step Solution
Solution:
  1. Step 1: Compare backticks and $() features

    Both run commands, but backticks are harder to nest because of confusing quotes.
  2. Step 2: Understand why $() is preferred

    $() syntax is clearer and supports nesting commands easily without escaping.
  3. Final Answer:

    Because $() allows easier nesting of commands -> Option C
  4. Quick Check:

    $() preferred for nesting ease = Because $() allows easier nesting of commands [OK]
Quick Trick: Use $() for nested command substitution [OK]
Common Mistakes:
MISTAKES
  • Thinking backticks are deprecated
  • Believing $() runs commands faster
  • Assuming backticks always cause errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes