until loop

A loop that runs its body again and again until a test command succeeds, the reverse of while.

In more detail

It suits waiting for something to become ready, as in until ping -c 1 host; do sleep 1; done. Add a limit on attempts so it cannot wait forever.

Example

until [[ $tries -eq 3 ]]; do ((tries++)); done

Related terms

Taught in

References