LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-22-2004, 11:57 AM   #1
captain-cat
LQ Newbie
 
Registered: Jun 2004
Location: UK
Distribution: Fedora-C2
Posts: 27

Rep: Reputation: 15
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?
 
Old 06-22-2004, 12:34 PM   #2
arobic
Member
 
Registered: Jul 2003
Location: Geneva, Switzerland
Distribution: Debian 3.1, SLC3 (based on RHEL)
Posts: 84

Rep: Reputation: 15
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...
 
Old 06-22-2004, 02:22 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 06-22-2004, 04:09 PM   #4
captain-cat
LQ Newbie
 
Registered: Jun 2004
Location: UK
Distribution: Fedora-C2
Posts: 27

Original Poster
Rep: Reputation: 15
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

Last edited by captain-cat; 06-22-2004 at 04:17 PM.
 
Old 06-22-2004, 04:24 PM   #5
arobic
Member
 
Registered: Jul 2003
Location: Geneva, Switzerland
Distribution: Debian 3.1, SLC3 (based on RHEL)
Posts: 84

Rep: Reputation: 15
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!
 
Old 06-22-2004, 04:46 PM   #6
captain-cat
LQ Newbie
 
Registered: Jun 2004
Location: UK
Distribution: Fedora-C2
Posts: 27

Original Poster
Rep: Reputation: 15
thanks again for answering my questions.
 
Old 06-22-2004, 06:18 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 06-22-2004, 06:51 PM   #8
macarthor
Member
 
Registered: Jun 2004
Posts: 37

Rep: Reputation: 15
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
 
Old 06-22-2004, 07:58 PM   #9
captain-cat
LQ Newbie
 
Registered: Jun 2004
Location: UK
Distribution: Fedora-C2
Posts: 27

Original Poster
Rep: Reputation: 15
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)
 
Old 06-23-2004, 05:22 AM   #10
captain-cat
LQ Newbie
 
Registered: Jun 2004
Location: UK
Distribution: Fedora-C2
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why do we have to export variables? learnfast Linux - Newbie 2 05-27-2005 08:27 AM
export variables alaios Linux - General 3 12-04-2004 07:33 AM
export variables radnix Linux - General 2 04-28-2004 06:52 PM
Why wont my variables export? suerevans Linux - Newbie 5 04-05-2004 03:46 AM
really easy question: why won't my environment variables export digitized_funk Linux - Newbie 3 10-22-2003 05:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration