So saying:
for a in * ; do
blah "$a"
done
has no limit, whereas
blah2 *
does have a limit (of about 20K characters, IIRC).
(hmmm, maybe more on the 2.6 kernel -- I can't seem to generate that
dreaded "Argument list too long" message except by doing something
stupid like: ls -lA /var/spool/news/message.id/*/* )
And imho, much easier than dealing with xargs and find -exec whatnot ;
Also, if spaces are a problem, fancy quotes can deal with that:
for f in `ls *.bmp`; do echo "$f"; done <-- Note I have NOT tested this.
Nope.
#mkdir tmp
#cd tmp
#for i in `seq 1 10000` ; do touch "blah $i" ; done
#for f in `ls *`; do ls -lA "$f"; done
ls: blah: No such file or directory
ls: 1: No such file or directory
ls: blah: No such file or directory
ls: 10: No such file or directory
ls: blah: No such file or directory
ls: 100: No such file or directory
ls: blah: No such file or directory
ls: 1000: No such file or directory
ls: blah: No such file or directory
....
Because each space output by the backticks causes the for loop to plop
the next bit into a new loop.