Nov 7, 2018

Example of Loops in Linux Shell


1
2
3
4
5
#!/bin/bash
for f in `seq 26 30`
do
echo $f
done

Or


1
2
3
4
5
6
#!/bin/bash
declare -a arr=(26 27 28 29 30)
for f in "${arr[@]}"
do
echo $f
done

Output:
26
27
28
29
30