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

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: <4.3.1.2.20001122101632.020a3520@pop.ma.ultranet.com>
X-Sender: lhall AT pop DOT ma DOT ultranet DOT com
X-Mailer: QUALCOMM Windows Eudora Version 4.3.1
Date: Wed, 22 Nov 2000 10:22:20 -0500
To: Sylvain Petreolle <spetreolle AT yahoo DOT fr>, cygwin AT cygwin DOT com
From: "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com>
Subject: Re: Newbie: read works incorrectly
In-Reply-To: <20001122150559.24323.qmail@web4805.mail.yahoo.com>
Mime-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id KAA24906

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
> > 
>The '\r\n' statement tells to printf to inser a new
>line, then remove it.


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. 



Larry Hall                              lhall AT rfk DOT com
RFK Partners, Inc.                      http://www.rfk.com
118 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX



--
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