Subject: RE: Newbie: read works incorrectly [drifting OT]
From: Mike Little <[email-masked]>
To: "'Randall R Schulz'" <[email-masked]>
Cc: [email-masked]
Date: Wed, 22 Nov 2000 17:22:28 -0000

> -----Original Message-----
> From: Randall R Schulz [mailto:[email-masked]]
> Sent: Wednesday, November 22, 2000 5:06 PM
> To: Mike Little; [email-masked]
> 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: [email-masked]

--
Want to unsubscribe from this list?
Send a message to [email-masked]