| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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 |
| To: | cygwin AT cygwin DOT com |
| X-Injected-Via-Gmane: | http://gmane.org/ |
| Path: | not-for-mail |
| From: | James Hu <jxh AT despammed DOT com> |
| Subject: | Re: About ENV? |
| Date: | Fri, 18 Oct 2002 15:56:34 +0000 (UTC) |
| Organization: | Despammed |
| Lines: | 33 |
| Message-ID: | <aopavh$g30$1@main.gmane.org> |
| References: | <3DAFAAB7 DOT 6070502 AT 21cn DOT com> |
| NNTP-Posting-Host: | 12-235-37-95.client.attbi.com |
| X-Trace: | main.gmane.org 1034956594 16480 12.235.37.95 (18 Oct 2002 15:56:34 GMT) |
| X-Complaints-To: | usenet AT main DOT gmane DOT org |
| NNTP-Posting-Date: | Fri, 18 Oct 2002 15:56:34 +0000 (UTC) |
| User-Agent: | slrn/0.9.7.4 (CYGWIN_NT-5.0) |
In article <3DAFAAB7 DOT 6070502 AT 21cn DOT com>, Huang. wrote:
> Why env in cygwin work like these:
I am sure this is off topic, since all UNIX shells based on Bourne
shell will behave this way. This is not specific to Cygwin.
> $ AAAA=aaa echo $AAAA
This syntax says: Set variable AAA to aaa in the environment of the
command "echo $AAA". However, the command "echo $AAA" will echo the
value of variable AAA in the current environment, since the expansion
of variables occurs before the command is executed.
> $ AAAA=aaa; echo $AAAA
> aaa
According to the explanation above, this is expected behavior.
> $ echo $AAAA
> aaa
According to the explanation above, this is expected behavior.
To do what I think you want to test try the following:
AAA=bbb eval 'echo $AAA in' ; echo $AAA out
or AAA=bbb sh -c 'echo $AAA in' ; echo $AAA out
or (AAA=bbb; echo $AAA in) ; echo $AAA out
All of these commands involve echoing the value of AAA in an environment
that is in the inner scope of the environment of the command line.
-- James
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |