The until loop will continue until a specific requirement is met or as long as the exit status is NOT zero. This is the opposite of the while loop.
In the example below you can see that the variable “i” starts with 0 and will loop until it equals 100. It is incremented by one each loop. When it reaches 100 it will deliver the zero as an indication of success and the loop will stop.
until [ $i -eq 100 ]
i=$(( $i +1 ))
Here is the opposite script counting down from 200. This script counts down until the number is less than 9. Note that let is used with a negative number.
until [ $COUNTER -lt 9 ];
echo COUNTER $COUNTER