Skip to Content
The Linux Command Line
book

The Linux Command Line

by William E. Shotts Jr.
January 2012
Beginner content levelBeginner
480 pages
17h 46m
English
No Starch Press
Content preview from The Linux Command Line

Chapter 29. Flow Control: Looping with while and until

In the previous chapter, we developed a menu-driven program to produce various kinds of system information. The program works, but it still has a significant usability problem. It executes only a single choice and then terminates. Even worse, if an invalid selection is made, the program terminates with an error, without giving the user an opportunity to try again. It would be better if we could somehow construct the program so that it could repeat the menu display and selection over and over, until the user chooses to exit the program.

In this chapter, we will look at a programming concept called looping, which can be used to make portions of programs repeat. The shell provides three compound ...

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.
Start your free trial

You might also like

The Linux Command Line, 2nd Edition

The Linux Command Line, 2nd Edition

William E. Shotts
Linux Fundamentals

Linux Fundamentals

Sander van Vugt

Publisher Resources

ISBN: 9781593273897Errata Page