< Previous | Contents | Next >
33 – Flow Control: Looping With for
In this final chapter on flow control, we will look at another of the shell’s looping con- structs. The for loop differs from the while and until loops in that it provides a means of processing sequences during a loop. This turns out to be very useful when programming. Accordingly, the for loop is a very popular construct in bash scripting.
A for loop is implemented, naturally enough, with the for compound command. In modern versions of bash, for is available in two forms.