Exit status of a command

We know every command in the shell returns an exit status. The exit status of 0 shows successful execution while a non-zero value shows the failure of execution. The until loop executes till the condition returns to a non-zero exit status.



Bash Scripting – Until Loop

The Bash has three types of looping constructs namely for, while, and until. The Until loop is used to iterate over a block of commands until the required condition is false.

Similar Reads

Syntax of `Until` Loop

until [ condition ]; do block-of-statements done...

Infinite Loop using Until

In this example the until loop is infinite i.e it runs endlessly. If the condition is set in until the loop is always false then, the loop becomes infinite....

Until Loop with break and continue

This example uses the break and the continue statements to alter the flow of the loop....

Until Loop with Single condition

This is an example of a until loop that checks for only one condition....

Until Loop with Multiple conditions

Until loop can be used with multiple conditions. We can use the and : ‘&&’ operator and or: ‘||’ operator to use multiple conditions....

Exit status of a command:

We know every command in the shell returns an exit status. The exit status of 0 shows successful execution while a non-zero value shows the failure of execution. The until loop executes till the condition returns to a non-zero exit status....