Bash until Loop
An until loop repeats its commands until the condition becomes true.
It is the opposite of while: the loop runs as long as the condition is false.
Count until a limit
Save this as until.sh:
#!/bin/bash
count=1
until [ $count -gt 3 ]; do
echo "Count: $count"
count=$((count + 1))
done
Run it:
./until.sh
Count: 1
Count: 2
Count: 3