-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Юрий Пухальский on 11/26/2009 1:02 PM:
> Good day!
> 
> Theres is a problem with a following code:
> 
> echo a:b|IFS=: read a b; echo $a

This is E4 in the FAQ:
ftp://ftp.cwru.edu/pub/bash/FAQ

POSIX permits, but does not require, that the final element of a pipeline
be executed in a subshell.  Bash uses the subshell, ksh does not.
Variable assignments in a subshell do not affect the parent.

Meanwhile, read obeys IFS according to POSIX, as shown by:

$ IFS=: read a b <<EOF
> 1:2
> EOF
$ echo $a
1

- --
Don't work too hard, make some time for fun as well!

Eric Blake             e...@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAksO4IwACgkQ84KuGfSFAYBZJACXegDrdvJQ/f/gS5e/8Yv4uK4o
3wCgkMPnOh7I9ttElaHtQrMBzCJa1lg=
=C2Ol
-----END PGP SIGNATURE-----


Reply via email to