Reputation: 1682
What I want to do is something similar to the python codes beneath, while the variables start, end, and spacing could all be float numbers and start > end.
for i in numpy.arange(start, stop, step):
print i
Or,
for i in numpy.linspace(start, stop, num):
print i
I know awk is handy (see the second answer in the question).
num=$(awk "BEGIN{for(i=${start};i>=${stop};i-=${step})print i}")
for n in $num
do
Do Something With $n
done
But, how to realize the iteration over a list of floating numbers in decrement in Bash without using awk?
Thanks !
Upvotes: 0
Views: 708