Linux Shell Scripting Tutorial (LSST) v1.05r3
Prev
Chapter 3: Shells (bash) structured Language Constructs
Next

Loops in Shell Scripts

Loop defined as:
"Computer can repeat particular instruction again and again, until particular condition satisfies. A group of instruction that is executed repeatedly is called a loop."

Bash supports:

Note that in each and every loop,

(a) First, the variable used in loop condition must be initialized, then execution of the loop begins.

(b) A test (condition) is made at the beginning of each iteration.

(c) The body of loop ends with a statement that modifies the value of the test (condition) variable.


Prev
Home
Next
Multilevel if-then-else
Up
for loop