LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   keep my export variables (https://www.linuxquestions.org/questions/linux-newbie-8/keep-my-export-variables-196420/)

captain-cat 06-22-2004 11:57 AM

keep my export variables
 
hi,

i have the following problem. i am exporting an environment variable and after i close the terminal it is lost. how can i keep my export variables? or actually how can i load them everytime i launch a console. i think i need to add them in my .bash_profile file. is that correct?

arobic 06-22-2004 12:34 PM

Hi!

To make sure that a variable is exported in every terminal, indeed you need to call it everytime you open a terminal. To do this, you have to export it in one of the configuration files specific to your shell, in this case .bashrc, .bash_profile, etc...

Tinkster 06-22-2004 02:22 PM

And to find out which one you'll need to modify you'll
have to determine whether your bash is being invoked
as a login-shell or not.

man bash
/^INVOCATION


Cheers,
Tink

captain-cat 06-22-2004 04:09 PM

thanks for the replies. i will read the man pages and see which one it is. by the way if you have time what is the /^something option. i guess i will have to do man man to see what is that.

thanks

arobic 06-22-2004 04:24 PM

It's just to tell you to search for the invocation part of the man page.

Whenever you are in a text editor, you can (almost) always use / followed by your search pattern to find something quicker than by scanning through the whole file.

So, /^invocation means look for a line beginning with invocation. Type this after typing man bash will lead you directly where you want to go!

captain-cat 06-22-2004 04:46 PM

thanks again for answering my questions.

Tinkster 06-22-2004 06:18 PM

Quote:

Originally posted by captain-cat
thanks for the replies. i will read the man pages and see which one it is. by the way if you have time what is the /^something option. i guess i will have to do man man to see what is that.

thanks

/^<searchterm>

/ starts a search
^ tells the search to look for the searchterm
only at the beginning of the line.
If you omit the ^ you'll get many hits in the
search, referring you to the term below (in this
instance, that is ;}).


man less for navigational details ... :)


Cheers,
Tink

macarthor 06-22-2004 06:51 PM

hi all, i've got another question

i wanna add /home/mcarthor/program to my system path, so it can, automatically, find binary files in /home/mcarthor/program/bin, include files (.h) in /home/mcarthor/program/include, library files in /home/mcarthor/program/lib, man files in /home/mcarthor/program/man, etc.

thx

captain-cat 06-22-2004 07:58 PM

hi, not sure if that is correct but as long as your local lib is concerned i think that you should add them on /etc/ld.so.conf

this allows the linker to look in these dirs when it compiles a source code. not sure though if that was what you were asking for

for the programs you could a link on your /usr/bin (not very convenient way though)

captain-cat 06-23-2004 05:22 AM

another not very convenient to include your local libraries is to export them into an evironment variable. if your are using bash

$export LIBRARY_PATH=$LIBRARY_PATH:/home/foo/fooslib

i presume there might be one for your local header files. similarly for bash
$export INCLUDE_PATH=$INCLUDE_PATH:/home/foo/foosinclude

if you are using csh then replace export with setenv
if you wanna see your variables
$echo $LIBRARY_PATH

because they will be lost after you close the shell, you may want to add the export lines in one of your shell config files. see above. most likely .bashrc


All times are GMT -5. The time now is 11:11 PM.