On Sat, Dec 15, 2001 at 12:26:13AM +0000, Sean Neakums wrote: > I usually do something like this: > > ls -1 --color=none | while read i ; do > do-something-to "$i" > done > > which ensures that you don't get tripped up by spaces in filenames, > although other metacharacters in filenames may cause hassle. Why the --color=none? You do know that ls(1) does not honor the UNIX programming philosophy of presenting the same output regardless of the classification of the target file descriptor, right? What do I mean? If the output of ls is targeted for stdout, it'll give you all the colors you ask for. When you pipe it, colors are stripped, and it prints out as -1 by default. Now, isn't that just convenient. The programmer thought he was doing you a favor. He just forgot to make the assumption that you'd expect the output to be the same regardless of its target file descriptor. Anyway, that's just a small beef with ls I've had for years. -- Chad Walstrom <chewie@wookimus.net> | a.k.a. ^chewie http://www.wookimus.net/ | s.k.a. gunnarr Get my public key, ICQ#, etc. $(mailx -s 'get info' chewie@wookimus.net)
Attachment:
pgpUfRCe4yvq2.pgp
Description: PGP signature