bash has three types of loop constructs
– for
– while
– until
until loop is used to iterate over the body of the loop till the condition stays false.
syntax:
until [ condition ];
do
block-of-statements
done
example:
#!/bin/bash echo “example of until” i=20 until [ $i == 1 ]; do # condition stays false echo "${i} is still greater than 1” i=$((i-1)) # i = i - 1 done echo “value of i = ${i}"
You may chose to throw this code in a shell script and see it go.