Exploring 'for' loop in bash
Filed in archive Tips & Tricks by mateusz on October 23, 2007

For loop in bash has many flavors, but that's a topic for another article, let's focus today on one of the simplest ones:
As you can imagine, this will list all the jpg files in my current dir. No better than ls. But wait, how about doing something with each and every of those files?
(For the above to work you need to have imagemagick installed)
With those couple of lines we have just resized all the pictures in current dir to thumbnail
size. Be careful, we write back to the same file (as the second parameter to convert shows), so there is no way back.As you can imagine from this simple example there is huge potential there. We will explore more of the for loop in further articles.
Permalink: Exploring 'for' loop in bash
Tags:
linux 2007 bash loop loop+bash exploring+loop tips+tricks
Trackback: http://www.creative-weblogging.com/cgi-bin/mt-tb.pl/98420













