-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Linux Command Line and Shell Scripting Bible - Third Edition
By :
The while command is somewhat of a cross between the if-then statement and the for loop. The while command allows you to define a command to test and then loop through a set of commands for as long as the defined test command returns a zero exit status. It tests the test command at the start of each iteration. When the test command returns a non-zero exit status, the while command stops executing the set of commands.
Here's fhe format of the while command:
while test command
do
other commands
done
The test command defined in the while command is the exact same format as in if-then statements (see Chapter 12). As in the if-then statement, you can use any normal bash shell command, or you can use the test command to test for conditions, such as variable values.
The key to the while command is that the exit status of the test command specified must change, based on the commands run during the loop. If the exit status never changes, the while...
Change the font size
Change margin width
Change background colour