Below is the simple bash script which show the way of incrementing the for loop by the value of "2" on each iteration:
#!/bin/bash
for i in {1..10..2}
do
echo $i
done
=== Output ====
1
3
5
7
9
for i in {1..10..2}
do
echo $i
done
=== Output ====
1
3
5
7
9
0 comments:
Post a Comment