Bash Scripting - LoopsIdentify the error in this infinite loop script:while true; do echo "Looping" AIncorrect use of 'true' instead of ':'BMissing 'done' keyword to close the loopCEcho command syntax is wrongDLoop condition should be in square bracketsCheck Answer
Step-by-Step SolutionSolution:Step 1: Check loop syntaxThe 'while' loop requires a closing 'done' keyword.Step 2: Identify missing partThe script lacks 'done' after the echo statement.Final Answer:Missing 'done' keyword to close the loop -> Option BQuick Check:Every 'while' loop must end with 'done' [OK]Quick Trick: Always close loops with 'done' [OK]Common Mistakes:MISTAKESForgetting 'done' at the endConfusing 'true' and ':' usageMisplacing semicolons
Master "Loops" in Bash Scripting9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Bash Scripting Quizzes Bash Scripting Basics - Running scripts - Quiz 10hard Bash Scripting Basics - Bash vs other shells (Zsh, Fish, sh) - Quiz 9hard Conditionals - [[ ]] extended test - Quiz 1easy Conditionals - Why conditionals branch script logic - Quiz 13medium Conditionals - test command and [ ] syntax - Quiz 12easy Quoting and Expansion - Arithmetic expansion $(( )) - Quiz 12easy User Input - Default values for input - Quiz 12easy User Input - read command - Quiz 7medium Variables - Environment variables vs local variables - Quiz 13medium Variables - Integer variables - Quiz 9hard