Loops
Sometimes you might want an operation to repeat until a certain condition becomes true (or until a certain condition is no longer true). This is where looping statements come into play. The Bourne shell supports three different looping constructs for these situations. These are the while loop, the until loop, and the for loop. We will look at each one separately.
The while Loop
The while loop repeats the statements inside the loop as long as the condition that is being tested is true. Depending on your point of view, it could also be said that the while loop repeats the statements inside the loop until the condition that is being tested becomes false. If the condition is already false the first time it is evaluated, the loop will never ...
Get FreeBSD® Unleashed 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.