Elmar Stellnberger <[EMAIL PROTECTED]> 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, [EMAIL PROTECTED]
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."


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to