About ENV?

John Vincent jpv50@hotmail.com
Fri Oct 18 05:18:00 GMT 2002


Hi,

Not quite right there ... You can preceed a command with an
assignment, and the assigned variable is then put into the
environment of the command that is run. Thus the command
"echo" is run with an environment variable AAAA with the
value aaaa. However, this does not change the AAAA shell
variable (which is currently empty) so the echo prints a
blank (it's empty argument) and ignores the AAAA in it's
environment.

This syntax is useful for setting environment variables
for one command invocation only. They are not saved.

I hope this fully explains what is going on.

/John Vincent.








>From: "Elfyn McBratney" <emcb_exposure@hotmail.com>
>To: "Huang." <hzhr@21cn.com>
>CC: <cygwin@cygwin.com>
>Subject: Re: About ENV?
>Date: Fri, 18 Oct 2002 10:03:05 +0100
>
>Its just bash topology... If your setting a variable and calling a command
>after it, or doing anything on one line with another expression after it 
>you
>need to end the expression before starting another one, which is done with
>the semi-colon ';'.
>
>On the first one:
>
>$ AAAA=aaa echo $AAAA
>
>AAAA now looks like "aaa echo " unless AAAA already exists, and if so would
>contain the variable contents after the "echo " bit...
>
>Elfyn
>----- Original Message -----
>From: Huang. <hzhr@21cn.com>
>To: <cygwin@cygwin.com>
>Sent: Friday, October 18, 2002 7:31 AM
>Subject: About ENV?
>
>
> > Why env in cygwin work like these:
> >
> > $ AAAA=aaa echo $AAAA
> >
> >
> > $ AAAA=aaa; echo $AAAA
> > aaa
> >
> > $ echo $AAAA
> > aaa
> >
> >
> > Maybe it not correct?
> >
> > Thanks.
> >
> >
> >
> >
> >
> >
> > --
> > 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/
> >
>
>--
>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/


_________________________________________________________________
Unlimited Internet access for only $21.95/month.  Try MSN! 
http://resourcecenter.msn.com/access/plans/2monthsfree.asp


--
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/



More information about the Cygwin mailing list