This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Piping to the 'read' command
- From: jim at cs dot ualberta dot ca (Jim Easton)
- To: cygwin at cygwin dot com
- Cc: Jim Easton <jim at cs dot ualberta dot ca>
- Date: Sun, 29 Oct 2006 01:22:39 -0700 (MST)
- Subject: Re: Piping to the 'read' command
Hi,
Fri, 27 Oct 2006 Eric Blake wrote:
> According to Jim Easton on 10/27/2006 1:43 AM:
> > 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.
Well isn't that interesting - I never noticed that before.
Obviously I've never needed to.
However, I don't think that has always been the case, as I recall,
when I first encountered Bourne shells, back in 1984, you could. I
got into the habit of assuming it would be different. For example; I
would define a temp file as TMP=tmp$$ in the parent and export it.
I wonder why? Anyone know?
Jim
--
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/