LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-07-2004, 10:16 PM   #1
m15a4
Member
 
Registered: Sep 2003
Distribution: SuSE 10
Posts: 55

Rep: Reputation: 15
Unhappy Path help needed please. I'm getting odd results.


Here's my current PATH when i type 'env' in a term...

PATH=/home/cisco/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/

I need to add /installs . So the path should look like...

PATH=/home/cisco/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/:/installs

I'm running SuSE Pro 9.0 and KDE, and have tried the following 3 variations of the command...

1---
PATH=$PATH:/installs
export PATH

2--
set PATH=$PATH:/installs
export PATH

2---
PATH=$PATH:/installs

I first tried that in a term window. It did add it, but when i login agian, the path is back to the original.

I then was going to try it in /etc/profie But SuSE's version of profile starts with the following...
# PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
# will be lost during system upgrades. Instead use /etc/profile.local for
# your local settings, favourite global aliases, VISUAL and EDITOR
# variables, etc ...

So, following their instructions, I edited /etc/profile.local. When i rebooted, the path was changed, ut the "new" path is listed TWICE!

Example
PATH=/home/cisco/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/:/installs:/installs

I removed it from that file and tried .bashrc and .profile (in my home dir) but that also made the path show up twice!

I think what's happening is the file is being read once at boot up and the path is altered. The file then gets read a 2nd time when a term window is opened thus duplicating the "new" path.

I really need help folks I've searched all the old topics and google and just can't find anything on topic.
 
Old 02-08-2004, 08:13 AM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,790
Blog Entries: 1

Rep: Reputation: 414Reputation: 414Reputation: 414Reputation: 414Reputation: 414
Quote:
I think what's happening is the file is being read once at boot up and the path is altered. The file then gets read a 2nd time when a term window is opened thus duplicating the "new" path.
Actually, I bet that you haven't commented out one of the changes you made. For example, if you have your PATH changes in both /etc/profile.local AND in your ~/.bashrc then you might see it listed twice. The good news is that having the /install listed twice in your path shouldn't be causing any trouble.
 
Old 02-08-2004, 09:40 PM   #3
m15a4
Member
 
Registered: Sep 2003
Distribution: SuSE 10
Posts: 55

Original Poster
Rep: Reputation: 15
Nope, that's not it. Trust me, i've octuplit checked. Besides. If I remove it from the one (1) place it is listed, it removes BOTH coppies from the PATH env.

Good thought though.

Quote:
Originally posted by Hangdog42
Actually, I bet that you haven't commented out one of the changes you made. For example, if you have your PATH changes in both /etc/profile.local AND in your ~/.bashrc then you might see it listed twice. The good news is that having the /install listed twice in your path shouldn't be causing any trouble.
 
Old 02-08-2004, 10:33 PM   #4
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
Different people do the same things in different ways, and different distros behave in different ways....some people have said put all your env variables in .bash_profile or .profile, but this doesn't do diddly for me. So I put everything in .bashrc, regardless of whether it's meant for a login shell or not...seems to work fine. My $PATH also includes ~/bin:~/bin:~/bin:/home/mik/bin:....
It doesn't cause any problems, though, so I say if it ain't broke don't fix it.
 
Old 02-09-2004, 01:47 AM   #5
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Re: Path help needed please. I'm getting odd results.

Quote:
Originally posted by m15a4
I think what's happening is the file is being read once at boot up and the path is altered. The file then gets read a 2nd time when a term window is opened thus duplicating the "new" path.
Yeah. Your command is 'PATH=$PATH:/install' which means set my path to be 'foo bar install'. So if the command is excuted again, $PATH is now 'foo bar install' so it means set my path to 'foo bar install install'. Type 'bash' in an xterm and 'echo $PATH' and it'll be on there 3 times. If you explicitly define your full path, it won't repeat. But why do you need help? It doesn't hurt anything if it does repeat. You want it on your path, so it is.

What I don't understand is why an aterm bash has a $SHLVL of 3 (login bash, X script bash, aterm?) but only repeats once. I guess one of those shell levels must have a '--norc' '--noprofile' option or something? But since my machine doesn't burst into flames, I don't worry about it. Too much.
 
Old 02-10-2004, 08:50 PM   #6
m15a4
Member
 
Registered: Sep 2003
Distribution: SuSE 10
Posts: 55

Original Poster
Rep: Reputation: 15
Re: Re: Path help needed please. I'm getting odd results.

Quote:
Originally posted by digiot
If you explicitly define your full path, it won't repeat. But why do you need help? It doesn't hurt anything if it does repeat. You want it on your path, so it is.
So, what would be the best way to explicity add this dir to my path? (without the path=$path blah line)
 
Old 02-10-2004, 09:27 PM   #7
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Well, I mean to say 'path:path:blah:install' instead of '$PATH:install'. Remove the variable so it doesn't go into the additive loop... but that defeats the advantages of nifty variables like that. So, on the other hand, you could actually rig up some weird conditional path where, if your path already includes that path, you don't export it.
Code:
if [ ! `echo $PATH|grep install` ]; then export PATH="$PATH:/install"; fi
Hey. Damn. I think that works. Might have bugs but I may try that on my own path additions. :)
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Path reference in Linux (Absolute path) javabuddy Linux - General 7 06-05-2006 07:45 AM
"java_runtime >= 1.4 is needed by freemind-0.7.1-2 " // PATH problem ? jfd Linux - Software 2 06-05-2004 07:05 AM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 06:10 PM
How to configure path to needed *.h files ??? ababkin Linux - Newbie 2 04-02-2004 11:40 AM
Odd results from df command avantman42 Linux - General 0 11-17-2003 10:01 AM


All times are GMT -5. The time now is 11:46 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