Bird
0
0

Which of the following is the correct syntax to start a while loop in bash?

easy📝 Syntax Q12 of 15
Bash Scripting - Loops
Which of the following is the correct syntax to start a while loop in bash?
Awhile [ condition ]; do
Bwhile ( condition ) {
Cwhile condition then
Dwhile { condition } do
Step-by-Step Solution
Solution:
  1. Step 1: Recall bash while loop syntax

    The correct syntax uses square brackets for condition and 'do' keyword.
  2. Step 2: Match options with correct syntax

    while [ condition ]; do matches the correct bash syntax: while [ condition ]; do.
  3. Final Answer:

    while [ condition ]; do -> Option A
  4. Quick Check:

    Correct bash while syntax = while [ condition ]; do [OK]
Quick Trick: Use square brackets and 'do' to start while loop [OK]
Common Mistakes:
MISTAKES
  • Using parentheses instead of square brackets
  • Missing 'do' keyword
  • Using curly braces incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes