delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/11/22/12:55:31

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: <E5C79049D461D311B83100062950B54A70D105@nt-stoc-0.sbs>
From: Mike Little <M DOT Little AT servicepower DOT com>
To: "'Randall R Schulz'" <rschulz AT teknowledge DOT com>
Cc: cygwin AT cygwin DOT com
Subject: RE: Newbie: read works incorrectly [drifting OT]
Date: Wed, 22 Nov 2000 17:22:28 -0000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2650.21)

> -----Original Message-----
> From: Randall R Schulz [mailto:rschulz AT teknowledge DOT com]
> Sent: Wednesday, November 22, 2000 5:06 PM
> To: Mike Little; cygwin AT cygwin DOT com
> Subject: RE: Newbie: read works incorrectly
> 
> Mike,
> 
> In the BASH "help" output for "printf" there is nothing that states 
> that if there are more arguments than there are formatting directives 
> in the format control string that the control string will be reused 
> as necessary to consume all the arguments. However, in the "man" page 
> for BASH it states exactly that.

Perhaps that's a bash bug that needs reporting to the maintainer of bash.
I'm not sure whether the built-in help is meant to be comprehensive.
 
> 
> I like you signature. 
Thanks, I stole it from someone else ;-) But it kinda summarizes my
philosophy 
on life.

> I never knew of the "printf" built-in before 
> this topic thread showed up! Perhaps that's because it post-dates the 
> printed BASH manual I usually rely on. Do you or does anyone know 
> with which version of BASH the "printf" built-in first appeared?

I only vaguely recall it's existence, I'd never used it.

One further example that I think illustrates how it works and which maybe
what the 
original poster intended.

echo "one two three
four five" | while read line ; do
 printf '%s\r\n' "$line"
done
 
results in 
one two three
four five

That is, each line of input to the while loop is printed separately
regardless
of the number of separate words.


Hope this helps,
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