Sunday, August 26, 2018

Bash Script Increment the loop by some value on each iteration

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




visit link download

No comments:

Post a Comment