The until loop lets you execute a series of commands until a condition is true. The until loop is really the opposite of the while loop in its processing. The while loop should always be preferred to the until loop, but in some cases – and it’s only a few – the until loop does the job better.
The format of the until loop is:
until condition command1 ... done
The condition is any valid test condition. The test takes place at the end of the loop, therefore it will always loop once – be aware of that please.
Here are a few examples.
This script continuously greps the who command for the user root. The variable IS_ROOT holds the result of the grep.
If root is found, the loop finishes processing. A ...