fo in bash code example
Example 1: bash for loop
for VARIABLE in file1 file2 file3
do
command1 on $VARIABLE
command2
commandN
done
Example 2: bash loop counter
TEMPFILE=/tmp/$$.tmp
echo 0 > $TEMPFILE
# Loop goes here
# Fetch the value and increase it
COUNTER=$[$(cat $TEMPFILE) + 1]
# Store the new value
echo $COUNTER > $TEMPFILE
# Loop done, script done, delete the file
unlink $TEMPFILE