Subject: Re: This has GOT to be a bug in ksh...
To: None <netbsd-users@netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-users
Date: 06/17/2002 14:58:24
[ On Monday, June 17, 2002 at 10:49:12 (-0700), Daniel Mercer wrote: ]
> Subject: Re: This has GOT to be a bug in ksh...
>
> Wow. Clearly, I should never hit 'send' before coffee.
> I missed the fact that quotes were wanted around the filename. In
> fact, the suggestion I was commenting on would not provide that
> output either. Perhaps this is closer:
> 
> find . -type f | (while read f; do echo "\"$f\""; done)
> 
> "./Berra äter ost"
> "./Lisa visar rattarna"
> 
> I'm going to go hunt down that coffee now. =)

Good idea -- then you can see how to optimise away the extra sub-shell
too!  ;-)

I don't think the point is to put quotes around the filenames either --
that's far more trivially done without a loop¹ -- the point is to avoid
having filenames with spaces be split into multiple parameters when
they're given one by one to some other command.



¹ find . -type f | sed -e 's/^/"/' -e 's/$/"/'

-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>