Peter Hardy wrote:

Oh, cool. I seem to recall having problems with the "for file in *" construct, but I don't remember what they were, so I'll try it again next time I want a for loop.

The problem you'll have with "for file in *" is that when you have
a ridiculously large number of files in a directory you will find
that the maximum size of a command line is exceeded by "*".

So the way around that is, when you hit that problem, replace this:

for file in *; do
  do_something_with $file
done

with this:

ls | while read file; do
  do_something_with $file
done

... the latter is a smudge less efficient, however.

--
Del
Babel Com Australia
http://www.babel.com.au/
ph: 02 9368 0728
fax: 02 9368 0758
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to