March 2002
Beginner
504 pages
10h 47m
English
The while loop enables you to execute a set of commands repeatedly until some condition occurs. It is normally used when you need to manipulate the value of a variable repeatedly. The basic syntax of the while loop is
while cmd do list done
Here, cmd is a single command, whereas list is a list of one or more commands. Although command can be any valid UNIX command, it is usually a test expression of the type covered in Chapter 11, “Flow Control.” The list called list is commonly referred to as the body of the while loop. The do and done keywords are not considered part of the body of the loop because the shell uses them only for determining where the while loop begins and ends.
The execution of a while loop proceeds according ...
Read now
Unlock full access