February 2001
Beginner to intermediate
448 pages
9h 2m
English
Official Description
Executes the while list repeatedly, and if the exit status of the last command in the list is 0 (zero), it executes the do list.
Syntax
while list ;do list ;done
Options
None
Oddities
The while loop is the same as the until loop except that the test is checking for a true value. If it finds one, it repeats the loop. The until loop checks for a false value and repeats the loop until the test evaluates to true.
Example
$ a=5 $ $ while (( $a>0 )) # Repeat the loop as long as a>0 > do > print $a > (( a=a-1 )) > done 5 4 3 2 1 $
Read now
Unlock full access