9 for <variable> in <items>; do <commands>; done
14 The for command is used to loop over a list of values and execute a series of
15 commands for each of these.
17 The counter variable of the loop is a shell variable. Please, keep in mind that
18 an environment variable takes precedence over a shell variable of the same name.
21 name of the counter variable
24 space separated item list
35 => for c in 1 2 3; do echo item ${c}; done
42 => for c in 1 2 3; do echo item ${c}; done
48 The first line ensures that there is no environment variable *c*. Hence in the
49 first loop the shell variable *c* is printed.
51 After defining an environment variable of name *c* it takes precedence over the
52 shell variable and the environment variable is printed.
57 The return value $? after the done statement is the return value of the last
58 statement executed in the loop.
62 => for i in true false; do ${i}; done; echo $?
64 => for i in false true; do ${i}; done; echo $?