O'Reilly logo

Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition by Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required