Answers for "for loop in a variable range bash"

4

for i in range bash

#Just use command seq to iterate a range from start to end
END=10
for i in $(seq 1 $END); do echo $i; done
Posted by: Guest on March-26-2021
0

bash iterate over a variable range of numbers

#!/bin/bash
START=1
END=5
for i in $(eval echo "{$START..$END}")
do
	echo "$i"
done
Posted by: Guest on April-29-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language