This is the mail archive of the
mailing list for the Cygwin project.
Re: Piping to the 'read' command
-----BEGIN PGP SIGNED MESSAGE-----
According to email@example.com 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
By the way, none of this thread is cygwin-specific.
Life is short - so eat dessert first!
Eric Blake firstname.lastname@example.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v22.214.171.124 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html