[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unix-ify File Names



On Tue, 17 Apr 2007, Roberto C. Sánchez wrote:

On Tue, Apr 17, 2007 at 03:36:26PM -0700, Mike McClain wrote:
Frank Terbeck <ft@bewatermyfriend.org> wrote:

 for FILE in `ls *$1` ; do

Please don't teach beginners to do for loops like this. It's broken in
various ways. Just do:

  for FILE in *"$1" ; do


Being a self taught script writer I just have to ask what are the
'various ways' in which the first form is broken?

The biggest one I can see is that it spawns an entire process when none
is needed.

Regards,

-Roberto

--
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com

Duly noted, makes perfect sense.  Bad habits are hard ones to break.

-+-
8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno.

Reply to: