what does export do?

linux user linuxusr at cableone.net
Mon May 23 15:38:49 UTC 2005


> Rick wrote:
> > linux user wrote:
> > >>>> .bashrc example:
> >>>>
> >>>> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:home/linux/lib
> >>>>
> >>>> After adding the above line to the .bashrc file, the load 
> >>>
> >>>
> >>> library path will be the same for every terminal and doesn't have to 
> >>> be set each time a new terminal is opened.
> >>>
> >>>> If you want this path to be available to any terminal that is 
> >>>
> >>>
> >>> open you will have to "source .bashrc" at the command prompt.  
> >>> Otherwise, just close all active terminals and open new ones.
> >>>
> >>>>
> >>> Errm don't you need to export that ie;
> >>> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:home/linux/lib
> >>> export LD_LIBRARY_PATH
> >>
> >>
> >>
> >>
> >> No.  Not in the .bashrc file.
> >>
> > I tried this both it /etc/bashrc and ~/.bashrc, it doesn't work without 
> > exporting it.
> 
> It'll be working for linux user because in the example shown, the 
> variable LD_LIBRARY_PATH will already be in the environment and hence 
> already exported.

Ok.  So to be safe, it's a good idea to export the environment variable if it's defined in the .bashrc file.

new .bashrc example

SCREWED_UP=$SCREWED_UP:yep
export SCREWED_UP

I'm happy...  Thanks for the clarification Paul.

> 
> Paul.





More information about the fedora-list mailing list