PDA

View Full Version : [SOLVED] for? for each? for every?



blenderfox
January 9th, 2011, 10:59 AM
Hi everyone.

I have a (hopefully) quick question which is regarding some scripting I used to do under a DOS/Windows env. I used to use the "for" command to iterate through a set of files in a directory using the line:


for each %1 in ([dir]) do [command]

But that doesn't work under bash. I presume the syntax is slightly different but doing


for --help

or


man for

Doesn't give me much any information at to syntax or usage.

I'm sure there is something in bash or the standard shell, I just can't seem to find it.

Can someone direct me in the right direction? :P

danieleds
January 9th, 2011, 12:05 PM
http://tldp.org/LDP/abs/html/loops1.html

Maybe that's useful

blenderfox
January 9th, 2011, 12:19 PM
Perfect. :) Thanks.