The until Statement
You can use the until statement to execute a series of commands until a specified condition is true.
The loop terminates as soon as the specified condition evaluates to true.
In pdksh and bash, the following format is used:
until expressiondo statementsdone
As you can see, the format of the until statement is similar to that of the while statement, but the logic is different: In a while loop, you execute until an expression is false, but in an until loop, you loop until the expression is true. An important part of this difference is that while is executed zero or more times (potentially not executed at all), but until is repeated one or more times, meaning it is executed at least once.
If you want to add the first five ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access