I would like to have a bash loop function like below, with decreasing sequency:
for i in {8..2}
do
...
done
And the 8 and 2 can be set as a variable, like:
start=$1
end=$2
for i in {$start..$end}
do
...
done
But seem this dose not work. How can I do this?
Thanks for all the quick answers, later I found the answer here. descending loop with variable bash
solution:
start=$1
end=$2
for i in `seq $start -1 $end`
do
...
done
Thanks~