This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About ENV?


On Fri, 18 Oct 2002, Andrew DeFaria wrote:

> John Vincent wrote:
>
> > 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.
>
> It doesn't. If "This syntax is useful for setting environment variables
> for one command invocation only" then the echo command should have
> echoed "aaa". Otherwise the syntax is not useful for setting environment
> variables for one command invocation. Perhaps what is meant is that this
> syntax is useful for overriding environment variables for one command
> invocation? However this leaves a glaring inconsistancy prone to error
> if the variable was not set already then no override takes place.

Andrew,

[pechtcha:~] AAAA=aaa && echo $AAAA
aaa
[pechtcha:~] AAAA=aaa echo $AAAA

[pechtcha:~] AAAA=aaa eval 'echo $AAAA'
aaa
[pechtcha:~] AAAA=aaa sh -c 'echo $AAAA'
aaa
[pechtcha:~]

Does this help?
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Water molecules expand as they grow warmer" (C) Popular Science, Oct'02, p.51


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]