what does export do?

akonstam at trinity.edu akonstam at trinity.edu
Fri May 20 21:50:15 UTC 2005


On Fri, May 20, 2005 at 09:40:22PM +0100, THUFIR HAWAT wrote:
> On 5/20/05, Matthew Miller <mattdm at mattdm.org> wrote:
> ...
> > > No files are affected by the command. All it does is mark a 
> > > shell variable as being an environment variable that is passed 
> > > on to any subsequent commands you execute *from that shell*.
> ...
> 
> "Every programming language has the ability to access its environment
> and to set or unset its variables. The environment is copied to all
> child processes through crt0.o which is linked into every executable."
> -Steven Orr
> 
> I'm looking at "export" within the context trying to find out where
> environment variables are stored.  In windows it's possible to bring
> up all the environment variables; I assume the same can be done with
> linux.  my question should've been:  where do I find the environment
> variables?
> 
> thanks,
> 
> Thufir
There is some confusion here. If we have a line:
export PATH=$PATH:$HOME/.

in a script. What export does is have $PATH available to subshells of
the shell running the script. If you source the script then the
subshell is the shell providing the command line and $PATH will an
environment variable accessible to all programs running in that shell.

However, if you execute that shell the $PATH will available only to
subshells on the shell you are executing and will not appear in the
environment.
-- 

=======================================================================
Fortune finishes the great quotations, #2

	If at first you don't succeed, think how many people
	you've made happy.
-------------------------------------------
Aaron Konstam
Computer Science
Trinity University
One Trinity Place.
San Antonio, TX 78212-7200

telephone: (210)-999-7484
email:akonstam at trinity.edu




More information about the users mailing list