I just installed openSUSE 11 RC. I have my $PATH definition in my home ~/.bashrc file, and everything was fine with SuSE 10.3 (however on another computer). Now, my $PATH variable contains twice every element defined in .bashrc.
It thus seems that the PATH defined in this file is sourced twice, which shouldn’t be the case, right?
It seems to me that it is read once then bash is invoked and once at login, since when I delete the file and relaunch the terminal without logging out, I got only one copy of the PATH. Whenever I logout, I then have none anymore. If then I login, I have none of the elements, and if I recreate the .bashrc file, and close the terminal and relaunch, I have again one. If I subsequently logout and login, I have two copies again…
hmm that’s weird i do not have $PATH set in my .bashrc file (i use Bash shell though), in any of my computers, however they are all running different versions than 11… so i cannot make valid comparison.
Anyway could you inspect your file /etc/profile
and paste those lines that follow a commented line that says # Make path more comfortable
Until the next commented line
Not sure if you have it (i am looking at my 10.3) but if so, inspecting those might give us some clues
#
# Make path more comfortable
#
if test -z "$PROFILEREAD" ; then
PATH=/usr/local/bin:/usr/bin:/bin
if test "$HOME" != "/" ; then
for dir in $HOME/bin/$CPU $HOME/bin ; do
test -d $dir && PATH=$dir:$PATH
done
fi
if test "$UID" = 0 ; then
test -d /opt/kde3/sbin && PATH=/opt/kde3/sbin:$PATH
PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
fi
for dir in /usr/X11/bin \
/usr/bin/X11 \
/usr/X11R6/bin \
/var/lib/dosemu \
/usr/games \
/opt/bin \
/opt/kde3/bin \
/opt/kde2/bin \
/opt/kde/bin \
/usr/openwin/bin \
/opt/cross/bin
do
test -d $dir && PATH=$PATH:$dir
done
unset dir
export PATH
fi
I remarked another strange behavior… When I renamed .bashrc .profile in my home dir, and logged out/in, I still had the PATH set correctly (and only once), but all the rest (aliases, PS1 export, LS_COLORS) was not set correctly. For example, there are a couple of aliases (like alias xxx=“ssh -X me@aaa.bbb.ccc.net”, that I removed from the file pasted above) that work quite well with .bashrc, but not with .profile…
That part of the /etc/profile is identical to mine.
If you are using bash, you should put stuff in .bashrc, not in .profile, which (as far as i know) is used for the shells ksh or sh.
My .profile file for example has one line only that is uncommented, which is just test -z “$PROFILEREAD” && . /etc/profile.
Now the cause of the double entries in your path might just be the fact that you are trying to edit the ~/.profile duplicating over there entries that are already in .bashrc… not sure if i understand well: is this what you are doing?
Can you post your ~/.profile content ?
First, and above all, thanks for your precious help… Should have started with that
I don’t use .profile and .bashrc at the same time. I use only .bashrc, and the .profile thing was just to try something. Normally, I don’t even have a .profile file in my home…
I have to add that I had exactly the same .bashrc on a SuSE 10.3 (but on another computer), and that it was working quite well (however I was accessing it with ssh).
Ok i see.
I was tempted to say to try commenting all the entries in .bashrc that have $PATH. However if your other machine does have the same entries, it might be the wrong point where to look for errors.
Do you have a file
/etc/bash.bashrc.local ?
I personally do not have, it does not even exist on my system. But if for some reasons it was created, it might be the cause of the anomalies, as it duplicates the entries in .bashrc
If you do not have that file, well i would try to comment out the entries in .bashrc that deal with PATH. In the worst case, even if you are no longer able to login normally as a user, you can always login as root and remove the comment symbols from the file, thus restoring the previous situation.
My suggestion is going on this way, if you ever encounter any problems in installing applications you can always add manually setting the path.
But i doubt you will have lots of problems, as i have been installing and manually compiling lots and lots of apps and never had any problems at all with paths
Well first of all normally program links should be in one of the folders existing in your path.
In fact if you open for example /usr/bin you will see a great amount of the programs you normally use is there. You dont need to add a path to each program folder, when you install any program (either compiling manually or through yast or through the rpm command) normally a link or the executable goes to one in the standard directories, such as /usr/bin.
Otherwise if for each new installed program you should add an entry to your path it would become just a mess and the lookup process when you type a command would be very time consuming
Now if you want, for some reasons, to add in your path another directory that is not there (make sure you really need that… that is, if you get an error): just add in you .bashrc and entry with $PATH=[path to the programs you want]
But ONLY to that directory: thats added to your existing path, it does not replace. So you must not add all the rest.
Yeah a double entry for the path wont change a lot but the lookup process when you type a command (lookup to check if that command is in your path) might be slightly longer, cuz it will lookup twice any folder listed there, until the command is found