[ale] Problems w/ mv and sed

David S. Jackson dsj at sylvester.dsj.net
Tue Dec 24 19:01:39 EST 2002


On Tue, Dec 24, 2002 at 02:53:15PM -0500 Geoffrey The Esoteric <esoteric at 3times25.net> wrote:
> >Also, the delimiter for "for" loops is a space.  If there are any spaces
> >in your files that bash ever sees, "for" will treat them as delimited
> >arguments in the forloop,
> 
> I don't believe this is correct, as this example demonstrates:
> 
> > ls -l
> -rw-r--r--    1 esoteric esoteric        0 Dec 24 14:48 the bar.mp3
> -rw-r--r--    1 esoteric esoteric        0 Dec 23 23:28 the foo.mp3
> 
> > for fn in the*;do
> echo file: $fn;done
> file: the bar.mp3
> file: the foo.mp3
> 
> Note, there are two files both containing a space.  The for loop 
> properly echo's each file on a separate line.

Try this:

for word in `ls *`; do
echo $word
done


It seems that "for blah in *" and "for blah in `whatever`" are
different.  I'm still thinking about why.  :-)

-- 
David S. Jackson                        dsj at dsj.net
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Life is divided into the horrible and the miserable.
		-- Woody Allen, "Annie Hall"
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list