This is the mail archive of the
mailing list for the Cygwin project.
Piping to the 'read' command
- From: cwmail at allmail dot net
- To: cygwin at cygwin dot com
- Date: Fri, 27 Oct 2006 11:03:49 +0800
- Subject: Piping to the 'read' command
Can anyone explain what is happening here (using pdksh as my shell) when
I try to set an environment variable using 'read':
$ read VAR1
$ echo "VAR1 is $VAR1"
VAR1 is Test1
This doesn't work:
$ echo Test2 | read VAR2
$ echo "VAR2 is $VAR2"
This works within the 'while' loop only:
$ echo Test3 | while read VAR3
> echo "VAR3 is $VAR3"
VAR3 is Test3
$ echo "VAR3 is $VAR3"
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html