Bird
0
0

What is the main purpose of using backticks (`) or $() in a bash script?

easy🧠 Conceptual Q1 of 15
Bash Scripting - Quoting and Expansion
What is the main purpose of using backticks (`) or $() in a bash script?
ATo run a command and use its output as a value
BTo comment out a line in the script
CTo declare a variable
DTo create a loop
Step-by-Step Solution
Solution:
  1. Step 1: Understand command substitution

    Backticks and $() are used to run a command inside a script and capture its output.
  2. Step 2: Identify their purpose

    This output can then be assigned to a variable or used directly in the script.
  3. Final Answer:

    To run a command and use its output as a value -> Option A
  4. Quick Check:

    Command substitution = To run a command and use its output as a value [OK]
Quick Trick: Use backticks or $() to capture command output [OK]
Common Mistakes:
MISTAKES
  • Confusing backticks with comments
  • Using backticks to declare variables
  • Thinking $() creates loops

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes