what does export do?

Steven W. Orr steveo at syslang.net
Fri May 20 20:57:54 UTC 2005


On Friday, May 20th 2005 at 21:40 +0100, quoth THUFIR HAWAT:

=>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?

On Friday, May 20th 2005 at 21:44 +0100, quoth THUFIR HAWAT:

=>something like getenv *?

The program to print out the who environment is env.

As to where it's stored, do read the environ manpage. Also look at 
the exec manpage. 

Normally when you run a C program, your environment is accessible as a 
char ** pointed to by the often unused third parameter to main.

main ( int argc, char * const argv[], char * const envp[] )

Also, you get a second crack at it via the external variable environ.

extern char **environ;

Of course all this is encapsulated in getenv(3) and setenv(3).

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net




More information about the fedora-list mailing list