The until-do-done loop is like the while-do-done loop. The only difference is that it tests the condition and goes on executing as long as the condition remains false. It terminates execution as soon as the condition becomes true.
until condition
do
command block
done
The execution is as follows :
1. Command condition is executed.
2. If the return code of the last command in condition is not 0 ( false), execute command block.
3. Return to step 1.
4. If the return code of the last command in condition is 0 (TRUE), skip to the first command following the done keyword.
#!/usr/bin/sh
echo "The until loop example"
echo
VAR1 = 1
until ( ( VAR1 > 100 ) )
do
echo "Value of the variable is : $VAR1"
( ( VAR1 = VAR1 * 2 ) )
done
echo
echo "The loop execution is finished"