delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/20/11:59:21

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
Message-ID: <3E550957.1070306@veritas.com>
Date: Thu, 20 Feb 2003 08:59:03 -0800
From: Bob McGowan <rmcgowan AT veritas DOT 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 AT cygwin DOT com
CC: Fred Ma <fma AT doe DOT carleton DOT ca>
Subject: Re: Question re. export environment variable
References: <3E550005 DOT 84B691EA AT doe DOT carleton DOT ca>
In-Reply-To: <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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019