HOWTO set Environment

Nifty Hat Mitch mitch48 at sbcglobal.net
Wed Oct 13 20:25:44 UTC 2004


On Wed, Oct 13, 2004 at 09:43:08AM +0200, fellons wrote:


> > >
> > > Someone can tell me how set an environment variable ?
> > >
> > > I try to set, on <userhome>/.bash_profile something like
> > > TEMP=/tmp
> > 
> > "export set TEMP=/tmp"
> > 
> > Try by executing ~/.bash_profile on the shell and then "echo $TEMP".
> > 
....
> I'm forgot to write than I make "export TEMP".
> Are the same thing of "export set TEMP=/tmp" ?

Caution different shells have different magic for setting shell
variables and exporting them to the environment.  A variable in the
shell need not be exported to the environment.  If it is not exported 
it will not be visible to child/sub processes.

If bash is the shell try these 

    BARK=woof
    echo $BARK
    env | grep BARK
    export BARK
    env | grep BARK
    export
    set

Older shell (sh) required two steps to set then export 
a variable.   "csh" had two magic words set and setenv
to pay attention to.

See also the man page for bash and environ (man 5 environ).


-- 
	T o m  M i t c h e l l 
	May your cup runneth over with goodness and mercy
	and may your buffers never overflow.




More information about the fedora-list mailing list