delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/22/10:41:27

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <E5C79049D461D311B83100062950B54A70D104@nt-stoc-0.sbs>
From: Mike Little <M DOT Little AT servicepower DOT com>
To: cygwin AT cygwin DOT com
Subject: RE: Newbie: read works incorrectly
Date: Wed, 22 Nov 2000 15:39:40 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id KAA25231

> -----Original Message-----
> From: Larry Hall (RFK Partners, Inc) [mailto:lhall AT rfk DOT com]
> Sent: Wednesday, November 22, 2000 3:22 PM
> To: Sylvain Petreolle; cygwin AT cygwin DOT com
> Subject: Re: Newbie: read works incorrectly
> 
> At 10:05 AM 11/22/2000, Sylvain Petreolle wrote:
> 
> >--- schwarza AT gdls DOT 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 AT ampersoft DOT co DOT uk
 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019