This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Piping to the 'read' command


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

According to Jim Easton on 10/27/2006 1:43 AM:
> Hi,
> 
> Fri, 27 Oct 2006 Ian Taylor wrote:
>> Can anyone explain what is happening here (using pdksh as my shell) when
>> I try to set an environment variable using 'read':

This is one of the bash FAQs.  Read E4 on
http://cnswww.cns.cwru.edu/~chet/bash/FAQ

> 
> This suggests to me that it is executing that read in a subshell that
> can't pass the variable back to its parent.  This dispite the fact that
> it appears to be the same process.  (see inserted echo $$)

Sorry, but POSIX requires $$ to be the same in subshells as it is in the
parent, even though that means that in subshells, it is not the parent
process id, but the grandparent.  There is no way, using $$, to tell
subshells apart from the original.

- --
Life is short - so eat dessert first!

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

iD8DBQFFQfWZ84KuGfSFAYARAhPMAJ9fPJvHGw4CsGmoCbpGQa3xmTFkdgCZAY6f
c2DXrvHx4SXeFCdICLOFj6Q=
=xPtQ
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]