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 ...

Get Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.