[arch-general] BASH no longer does 'for i in $(ls); do ls $i; done'??

Jan de Groot jan at jgc.homeip.net
Wed May 19 02:48:53 EDT 2010


On Wed, 2010-05-19 at 01:41 -0500, David C. Rankin wrote:
> So the bottom line is don't alias 'ls'. And, I guess, the next
> question would
> be, how or where can I safely customize the behavior of ls without
> screwing
> myself again. 

Solution is simple: don't use ls for the for loops you're doing. I just
tested it on my system, the colored files and directories give "No such
file or directory", which makes sense, as the variable contains ascii
chars for color information.

I would suggest using globbing, why would you use for i in $(ls); while
you can use for i in *;



More information about the arch-general mailing list