delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/27/08:43:50

X-Spam-Check-By: sourceware.org
Message-ID: <4541FEFE.4000902@byu.net>
Date: Fri, 27 Oct 2006 06:43:42 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, cwmail AT allmail DOT net
Subject: Re: Piping to the 'read' command
References: <01e301c6f9b3$26422890$a501a8c0 AT CAM DOT ARTIMI DOT COM> <1161952728 DOT 23693 DOT 274366024 AT webmail DOT messagingengine DOT com>
In-Reply-To: <1161952728.23693.274366024@webmail.messagingengine.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

According to cwmail AT allmail DOT net on 10/27/2006 6:38 AM:
> Thanks Dave - I guess I should have explained in my original email that
> I'm converting a ksh script which currently runs successfully under
> HP-UX. If I run the following command under HP-UX ksh:
> 
>  echo "Test" | read VAR1 
> 
> VAR1 will hold the value "Test" in the parent environment. This doesn't
> happen under Cygwin pdksh, and I don't understand why.

Because POSIX doesn't guarantee it.  POSIX states that it is unspecified
whether the last command in a pipeline executes in the parent or in a
subshell.  In HP-UX's ksh, they have implemented it as the parent shell.
But on cygwin, both bash and pdksh have implemented it as the child shell.
 And assignments made by read in the child shell don't propagate back to
the parent.

By the way, none of this thread is cygwin-specific.

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

Eric Blake             ebb9 AT byu DOT 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

iD8DBQFFQf7984KuGfSFAYARAmlnAKDUu4j05wRdT7rT+2suwZ1r1eLYhgCgqH6R
1fftRbWxuf6Zkj76Hgv/HyM=
=pv4W
-----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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019