until Loop
noun
say it: “un-TIL LOOP” /ənˈtɪl ˈlup/
A loop that keeps repeating its commands until a condition becomes true.
What is an until loop in bash?
An until loop is a while loop turned around: it repeats its lines for as long as its condition fails, and stops the moment it passes. It suits waiting, such as checking every two seconds until a file appears.
until [[ -e go.txt ]]; do
echo "Waiting for go..."
sleep 2
done
In a sentence
- “An until loop is handy when a script has to wait for something to happen.”
- “The until loop waited for go.txt before printing Go for launch.”
Level: Journeyman · More Unix terms at this level
Updated