Looping Constructs

In the next several sections of this chapter, you are introduced to four types of looping mechanisms. A looping mechanism is what enables a script writer to repeat a sequence of lines as many times as necessary. Without looping capability, if you wanted to repeat the same three lines of commands five times, you would have to simply type the lines in repetitively in your script. Using a looping mechanism, a repeat sequence is formed and a test is evaluated to determine whether the looping should repeat. As you will see, the positioning of the test and the steps for executing the loop vary slightly for the four flavors of looping.

This clunky technique does work, by the way. But it certainly has no elegance to it. It's like going ...

Get Korn Shell Programming by Example 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.