LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Suse/Novell
User Name
Password
Suse/Novell This Forum is for the discussion of Suse Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 09-03-2006, 11:38 PM   #1
krutten1986
LQ Newbie
 
Registered: Aug 2006
Location: Denver
Distribution: Suse 10.1
Posts: 21

Rep: Reputation: 15
Trouble setting PATH variable


I've been trying to edit my .bash_profile to include a directory that contains the java compiler in the PATH. I'm brand new to linux and am having a hard time to say the least...my understanding is that the PATH is defined in /etc/profile but to edit it you have to use ~/.bash_profile which is looked at before /etc/profile by the system...? In windows it was a matter of clicking an "Environment Variable" button and pasting the addition to the PATH you wanted at the end behind a semi-colon. There's gotta be a way to make this work.
 
Old 09-03-2006, 11:47 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, FreeBSD
Posts: 3,925
Blog Entries: 5

Rep: Reputation: Disabled
From the bash manpages:
Quote:
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable.
Example setting path:
Code:
export PATH=$PATH:/new/path/here
 
Old 09-04-2006, 12:27 AM   #3
krutten1986
LQ Newbie
 
Registered: Aug 2006
Location: Denver
Distribution: Suse 10.1
Posts: 21

Original Poster
Rep: Reputation: 15
right, and I can get the path to set like in the example you posted but then when I open a new session it has reset back to the original path. So I'm trying to figure out how to make it stay thanks for the response, makes it more understandable.
 
Old 09-04-2006, 09:23 AM   #4
EclipseAgent
Member
 
Registered: Oct 2005
Location: California
Distribution: SLED 10, openSuSE 10.2, Ubuntu Drapper
Posts: 713

Rep: Reputation: 30
They are only good for the current session.

You will have to do the following:

export PATH=$PATH:/what/ever/path >> ~/.profile
or
export PATH=$PATH:/what/ever/path >> ~/.bash_profile
Which ever you wanted it to work for
Note: Logged on as the normal user of course.
log off / log on

echo $PATH
Should be there

That will append the wanted string into .profile which will run at next logon.
 
Old 09-04-2006, 01:21 PM   #5
krutten1986
LQ Newbie
 
Registered: Aug 2006
Location: Denver
Distribution: Suse 10.1
Posts: 21

Original Poster
Rep: Reputation: 15
I was editing ~/.bash_profile so I tried the ~/.profile and worked perfect. Thanks for the help.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting the path variable for Java Comp. lmellen Programming 4 12-30-2004 09:51 AM
Setting the path variable for Java Comp. lmellen Programming 1 06-27-2004 10:38 PM
Setting Path Variable for LibXML2 Miyamoto Linux - Software 1 08-19-2003 09:00 AM
Help setting $PATH variable Nylex Linux - General 9 08-09-2003 11:44 AM
setting path variable shahrahulb Linux - General 2 07-30-2003 08:25 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration