linux poison RSS
linux poison Email

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

Related Posts with Thumbnails