Bird
0
0

Identify the error in this infinite loop script:

medium📝 Debug Q6 of 15
Bash Scripting - Loops
Identify the error in this infinite loop script:
while true; do
  echo "Looping"
AIncorrect use of 'true' instead of ':'
BMissing 'done' keyword to close the loop
CEcho command syntax is wrong
DLoop condition should be in square brackets
Step-by-Step Solution
Solution:
  1. Step 1: Check loop syntax

    The 'while' loop requires a closing 'done' keyword.
  2. Step 2: Identify missing part

    The script lacks 'done' after the echo statement.
  3. Final Answer:

    Missing 'done' keyword to close the loop -> Option B
  4. Quick Check:

    Every 'while' loop must end with 'done' [OK]
Quick Trick: Always close loops with 'done' [OK]
Common Mistakes:
MISTAKES
  • Forgetting 'done' at the end
  • Confusing 'true' and ':' usage
  • Misplacing semicolons

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes