Bird
0
0

What is wrong with this script snippet?

medium📝 Debug Q6 of 15
Bash Scripting - User Input
What is wrong with this script snippet?
#!/bin/bash
shift 0
echo "$1"
Ashift 0 removes all arguments
Bshift 0 is invalid and causes an error
Cshift 0 does nothing, so $1 remains unchanged
Dshift 0 reverses the arguments
Step-by-Step Solution
Solution:
  1. Step 1: Understand shift with zero

    Using shift 0 means shift zero positions, so no arguments are removed.
  2. Step 2: Effect on $1

    $1 remains the same as before shift.
  3. Final Answer:

    shift 0 does nothing, so $1 remains unchanged -> Option C
  4. Quick Check:

    shift 0 = no change [OK]
Quick Trick: Shift 0 leaves arguments unchanged [OK]
Common Mistakes:
MISTAKES
  • Thinking shift 0 causes error
  • Assuming shift 0 removes all args
  • Believing shift 0 reverses args

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes