This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Question re. export environment variable
- From: Bob McGowan <rmcgowan at veritas dot com>
- To: cygwin at cygwin dot com
- Cc: Fred Ma <fma at doe dot carleton dot ca>
- Date: Thu, 20 Feb 2003 08:59:03 -0800
- Subject: Re: Question re. export environment variable
- Organization: VERITAS Software, Inc.
- References: <3E550005.84B691EA@doe.carleton.ca>
Fred, perhaps this will help:
echo $TEST # Test has no value, hence the blank line.
$ TEST=noexport # Set but not exported
$ echo $TEST
noexport
$ env|grep TEST # Nothing found, no output.
$ export TEST # Export it.
$ env|grep TEST # And now it's found in the environment.
TEST=noexport
$ TEST=second # Change its value.
$ env|grep TEST # Same search as above, but the value is changed.
TEST=second
Perhaps the easiest way to look at it is to think of exporting as making a type
of global variable. Everyone (within certain limits; for the shell, only its
children...) will see the exported variable. If the value changes, it changes
"everywhere". I've quoted everywhere because this only applies to children
invoked after the change. So if TEST=second and you run an xterm, the new shell
sees TEST=second. Change TEST=third in the first shell, you still have
TEST=second in the second shell, since it already got its value for TEST. Start
a third shell from the first, it will see TEST=third. And so on.
Fred Ma wrote:
Hello,
I'm using cygwin bash 2.05b-8 (it's actually gnu).
I thought that $HOSTNAME was an environment
variable. When I run gnu make (I'm pretty
sure this is not a make problem), $(HOSTNAME)
is empty. It gets fixed if I do "export HOSTNAME"
before running make.
Is there a way to check if the export command
has been applied to $HOSTNAME? Does the
actual transcription of $HOSTNAME's value to
the environment happen only once, when
"export" is applied, or is there a continual
monitoring an mirroring of changes to $HOSTNAME
forever after applying "export"?
Fred
--
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/
--
Bob McGowan
Staff Development Engineer
VERITAS Software
rmcgowan at veritas dot com
--
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/