LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 11-04-2004, 08:44 PM   #1
anders_ant
LQ Newbie
 
Registered: Jul 2004
Location: Minneapolis, MN
Distribution: Slackware 9.1
Posts: 20

Rep: Reputation: 0
quick question about PATH variable


Newbie question here. I updated my PATH with export PATH=$PATH:new_directory and I was able to access programs in the new directory but my PATH was reset the next time I logged in. Do I need to save my settings when I make a change like this? If so how?

Thanks
 
Old 11-04-2004, 09:27 PM   #2
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
When you use the command line to do this, it sets the variable for your current shell. If you switch to another terminal and echo $PATH, you'll see it hasn't been changed there.

You need to add the changes to the right config file for your shell. For example, if you use bash, look in your home dir for .bash_profile or .bashrc - one of those files will have some commands that are always executed in a new shell. Add your updated PATH line to that file, then log out and back in again to test.
 
Old 11-04-2004, 10:34 PM   #3
anders_ant
LQ Newbie
 
Registered: Jul 2004
Location: Minneapolis, MN
Distribution: Slackware 9.1
Posts: 20

Original Poster
Rep: Reputation: 0
thanks CroMagnon
 
Old 11-04-2004, 10:40 PM   #4
anders_ant
LQ Newbie
 
Registered: Jul 2004
Location: Minneapolis, MN
Distribution: Slackware 9.1
Posts: 20

Original Poster
Rep: Reputation: 0
by the way if I don't have either .bash_profile or .bashrc is there another place where I could find it or do I need to create it?

also what specifically do I need to add to the file?

thanks
 
Old 11-04-2004, 11:17 PM   #5
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Another possibility is .profile... also, make sure you are listing all files (i.e ls -A), since they are hidden by default.

What you add to the file depends on what you find already in it... normally people set the variables needed via straight assignment and export them at the end (scripts run in a subshell, export sends one or more vars to the parent shell). There's a good chance your PATH is set and exported already, but the maximum you would have to add to the file is this:

PATH=$PATH:new_dir
export PATH
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
PATH environment variable moonz Red Hat 3 09-08-2005 04:10 PM
PATH variable jk21 Linux - Newbie 1 09-28-2004 02:48 PM
PATH variable on SuSE 9.1 sbk Linux - Distributions 3 08-05-2004 02:13 AM
$path variable ? moby Linux - Newbie 3 06-01-2004 03:18 PM
the path variable mjkramer Linux - Newbie 4 10-18-2003 07:18 AM


All times are GMT -5. The time now is 05:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration