loops in bash

I use bash regularly to manipulate data, run repeat tasks. There are many ways to carry out loops.

Example 1

for in in 1 2 3 4 5 6 7 8 9 10
do
echo $i
done

Example 2

for i in `seq 1 10 `
do
echo $i
done

Example 3

for (( i=1; i<11; i++ ))
do
echo $i
done

Example 4

while [ i -lt 11 ]
do
echo $i
i=` $i + 1 `
done

One response to “loops in bash

Leave a comment