Bird
0
0

Find the error in this script snippet:

medium📝 Debug Q7 of 15
Bash Scripting - Quoting and Expansion
Find the error in this script snippet:
files=$(ls -l
 echo $files
AMissing closing parenthesis for $()
BIncorrect command inside $()
CVariable name typo
DNo error
Step-by-Step Solution
Solution:
  1. Step 1: Check command substitution syntax

    The $() syntax must be closed with a matching parenthesis.
  2. Step 2: Verify variable usage

    Variable $files is correctly referenced in echo.
  3. Final Answer:

    Missing closing parenthesis for $() -> Option A
  4. Quick Check:

    Unclosed $() causes syntax error = Missing closing parenthesis [OK]
Quick Trick: Close $() with a matching parenthesis [OK]
Common Mistakes:
MISTAKES
  • Forgetting to close $()
  • Using wrong variable name
  • Incorrect command inside substitution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes