BASH – FOR loop with variable based range

 

If you need to execute the FOR loop the N number of times, and this value will be set by a variable, the script will look like this:

 

#!/bin/bash

END=10

for i in $(seq 1 $END)
do
    echo $i
done
0 0 vote
Article Rating

Tagged: Tags

Подписаться
Уведомление о
guest
0 Comments
Inline Feedbacks
View all comments