bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: documentation error in the FAQs


From: Andreas Schwab
Subject: Re: documentation error in the FAQs
Date: Sat, 03 Mar 2007 14:40:14 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.91 (gnu/linux)

Elmar Stellnberger <estellnb@lycos.at> writes:

> Bash Version: 3.1
> Patch Level: 17
> Release Status: release
> concerns: FAQ E4)
>
> "IFS=." inside a subprocess can not influence the read builtin:
> read A B C D < <(IFS=.; echo $(/usr/local/bin/ipaddr))

It is true that is has no effect on read, but is has effect on word
splitting, which is applied to the result of command substitution.

> should be:
> IFS="."
> read A B C D < <(echo $(/usr/local/bin/ipaddr))

This won't restore IFS.  An alternative that is equivalent to the command
in the FAQ:

IFS=. read A B C D < <(/usr/local/bin/ipaddr)

This is actually more efficient since it avoids the extra command
substitution.  But both have the same outcome if the output of
/usr/local/bin/ipaddr has no more than 4 dots.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]