One way is to use eval , a crude example,
for i in $(eval echo {0..$range}); do echo $i; done
another way is to use a bash C style for loop
for((i=1;i<=20;i++)) do ... done
And the latter is faster than the former (for example, if you have a range of $ 1,000,000)
kurumi
source share