[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IFS handling and read
From: |
Eric Blake |
Subject: |
Re: IFS handling and read |
Date: |
Thu, 26 Nov 2009 13:09:48 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
-----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 ebb9@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-----
- IFS handling and read, Юрий Пухальский, 2009/11/27
- IFS handling and read, Юрий Пухальский, 2009/11/26
- Re: IFS handling and read,
Eric Blake <=
- Re: IFS handling and read, Marc Herbert, 2009/11/30
- Re: IFS handling and read, Lhunath (Maarten B.), 2009/11/30
- Re: IFS handling and read, Greg Wooledge, 2009/11/30
- Re: IFS handling and read, Chris F.A. Johnson, 2009/11/30
- Re: IFS handling and read, Lhunath (Maarten B.), 2009/11/30
- Re: IFS handling and read, Chris F.A. Johnson, 2009/11/30
- Re: IFS handling and read, Chet Ramey, 2009/11/30
- Re: IFS handling and read, Lhunath (Maarten B.), 2009/11/30
- Message not available
- Re: IFS handling and read, Jan Schampera, 2009/11/30
- Re: IFS handling and read, Andreas Schwab, 2009/11/30