12 for <variable> in <items>; do <commands>; done
17 The for command is used to loop over a list of values and execute a series of
18 commands for each of these.
20 The counter variable of the loop is a shell variable. Please, keep in mind that
21 an environment variable takes precedence over a shell variable of the same name.
24 name of the counter variable
27 space separated item list
38 => for c in 1 2 3; do echo item ${c}; done
45 => for c in 1 2 3; do echo item ${c}; done
51 The first line ensures that there is no environment variable *c*. Hence in the
52 first loop the shell variable *c* is printed.
54 After defining an environment variable of name *c* it takes precedence over the
55 shell variable and the environment variable is printed.
60 The return value $? after the done statement is the return value of the last
61 statement executed in the loop.
65 => for i in true false; do ${i}; done; echo $?
67 => for i in false true; do ${i}; done; echo $?