for .. in .. (loop)

It is possible in bash to iterate over a list of element one by one usingthe for .. in .. instruction.

for variable in liste
do
 ...
done

Example:

for i in a b c d e 
do
  echo $i
done

Shell expansion can be used after the in keyword.

for i in f*
do
  echo "a file starting by f: $i"
done