Possible Duplicate:
How do I reverse a for loop?
Is there an easy way to invert a for in loop? For a script I want to process files in their reverse order.
So instead of:
for file in *.jpg;
do echo $file;
done
with the result
001.jpg
002.jpg
003.jpg
...
150.jpg
I want the result
150.jpg
149.jpg
148.jpg
...
001.jpg