Intermediate
Linux & Shell Scripting
Q55 / 100
What is the difference between "while" and "until" loops in bash?
Correct! Well done.
Incorrect.
The correct answer is A) A "while" loop continues executing as long as its condition is true, while an "until" loop continues executing as long as its condition is false (i.e. it stops once the condition becomes true)
A
Correct Answer
A "while" loop continues executing as long as its condition is true, while an "until" loop continues executing as long as its condition is false (i.e. it stops once the condition becomes true)
Explanation
"while [ condition ]; do ... done" runs while the condition is true, whereas "until [ condition ]; do ... done" runs while the condition is false, stopping as soon as it becomes true — they are logical opposites of each other.
Progress
55/100