delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-Id: | <1161918229.13218.274338644@webmail.messagingengine.com> |
From: | cwmail AT allmail DOT net |
To: | cygwin AT cygwin DOT com |
MIME-Version: | 1.0 |
X-Mailer: | MessagingEngine.com Webmail Interface |
Subject: | Piping to the 'read' command |
Date: | Fri, 27 Oct 2006 11:03:49 +0800 |
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 |
Can anyone explain what is happening here (using pdksh as my shell) when I try to set an environment variable using 'read': This works: $ read VAR1 Test1 $ echo "VAR1 is $VAR1" VAR1 is Test1 This doesn't work: $ echo Test2 | read VAR2 $ echo "VAR2 is $VAR2" VAR2 is This works within the 'while' loop only: $ echo Test3 | while read VAR3 > do > echo "VAR3 is $VAR3" > done VAR3 is Test3 $ echo "VAR3 is $VAR3" VAR3 is Regards Ian Taylor -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |