Saturday, May 12, 2012
2:56 AM

Bash Script: Increment the loop by some value on each iteration

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


0 comments:

Post a Comment