Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <3E550957.1070306@veritas.com>
Date: Thu, 20 Feb 2003 08:59:03 -0800
From: Bob McGowan <rmcgowan@veritas.com>
Organization: VERITAS Software, Inc.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021130
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: cygwin@cygwin.com
CC: Fred Ma <fma@doe.carleton.ca>
Subject: Re: Question re. export environment variable
References: <3E550005.84B691EA@doe.carleton.ca>
In-Reply-To: <3E550005.84B691EA@doe.carleton.ca>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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@veritas.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/

