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

Re: Maybe offtopic: Dealing with filenames with blanks in a script



Cameron Hutchison <camh+dl@xdna.net> said on Wed, 28 Apr 2004 08:51:29 +1000:
> Once upon a time diego said...
> > 
> > I'm trying to manage files that have one or more blanks in their names
> > [...] 
> > I want a script to do some processing on them, let's simplify with a
> > simple cat:
> > 
> > for i in `ls *`; do cat $i; done
> 
> Never use `ls *`, when a simple * will do.  eg: 
>   for i in * ; do cat $1; done

Also, you probably want to try a cat "$i" there - that will be your
next bug.

> Using `ls *` is causing the first of your problems, namely defining
> filename boundaries - you are losing them with `ls *`.

Could someone enlighten me as to why people keep on putting
superfluous `ls *` in their scripts? Pretty please?

That and the "useless uses of cat" awards.

-- 
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
My cats are forbidden from walking on my computer keyboard on the desk
when I'm asdfjjhhkl;ljfd.;oier' puyykmm4hbdm9lo9j USING IT. 



Reply to: