This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Newbie: read works incorrectly


> -----Original Message-----
> From: Larry Hall (RFK Partners, Inc) [mailto:lhall@rfk.com]
> Sent: Wednesday, November 22, 2000 3:22 PM
> To: Sylvain Petreolle; cygwin@cygwin.com
> Subject: Re: Newbie: read works incorrectly
> 
> At 10:05 AM 11/22/2000, Sylvain Petreolle wrote:
> 
> >--- schwarza@gdls.com a écrit : > 
> > > The following statement:
> > > 
> > >       echo one two | while read line ; do
> > >          printf '%s\r\n' $line
> > >       done
> > > 
> > > generates
> > > 
> > >       one
> > >       two
> > > 
> > > I would have expected
> > > 
> > >       one two
> > > 
> 
> Actually I think Art's problem is that he's working from an improper 
> supposition.  Just because read will put all the parameters 
> into "line"
> doesn't mean that "printf '%s\r\n' $line" will print both parameters.
> Try "printf '%s %s\r\n' $line" to get what you expected. 

Or try  
printf '%s\r\n' "$line"
to make $line into one argument to printf.

Mike
--
Mike Little
Share what you know. Learn what you don't.

ServicePOWER Business Solutions Ltd
home: mike@ampersoft.co.uk
 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]