> files= > for f in * > do [ -f "$f" ] && files="$files $f" > done > ... do stuff with $files ... > > If you've got to deal with filenames with whitespace in them you need > to be trickier.
I like how this works. But you are right, it does cause a problem for filenames with spaces. As far as cpu time (preceding the command with "time" to get same), we are only talking a few 1/100th of a second difference with the find command. The find command is more robust as it will properly deal with filenames with spaces. Not to mention find will also yield hidden files (i.e. .file) whereas the above won't. All depends on your needs as to which will serve you better. I've enjoyed this thread. Anytime I can learn something new about BASH then it's all good. Jacques B.