LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to change PATH in Debian squeeze (https://www.linuxquestions.org/questions/linux-general-1/how-to-change-path-in-debian-squeeze-4175426202/)

djmb 09-08-2012 12:59 AM

how to change PATH in Debian squeeze
 
Dear all,

I am trying to change my PATH. I recently added a prg to a directory; this prg is a newer version of another prg and I have to install both to get things running. But as I want the newer prg to be tried first (texlive, it's packaged based), I need to add its directory before other directories.

So I added the following at the top of the ~/.bashrc file:
PATH=$PATH:/home/me/newdir
export PATH

then I did
source ~/.bashrc

then:
echo $PATH

and I got:
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/me/newdir


any idea why /home/me/newdir is not first in the PATH? And how to have it first?

Thanks,

Ygrex 09-08-2012 01:23 AM

is this a joke?

djmb 09-08-2012 01:39 AM

Well no it is not. I guess there is something that I have not fully understood. Anything more constructive maybe?

414N 09-08-2012 02:22 AM

Your directory is not the first in PATH because you just put it at the end with:
Code:

PATH=$PATH:[yourdir]
This statement associates the variable PATH with $PATH (the previous content of PATH) followed by ":" then [yourdir].
You just have to reorder the assignment, like this:
Code:

PATH=[yourdir]:$PATH

djmb 09-08-2012 02:44 AM

ok, now I get it. Thanks,

414N 09-08-2012 03:15 AM

Mark the thread as solved, then ;)

djmb 09-09-2012 01:55 AM

done. I didn't know how it worked, sorry. Thx again,


All times are GMT -5. The time now is 05:33 AM.