Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm on a shared hosting account with a jailed shell and I'm terrible with $PATH. I'm using CentOS. Originally my host installed git in /usr/local/bin which didn't work out correctly, I suggested install git in my $HOME/opt/bin and it works perfectly. However, now there are two git installations. Using which git yields the /usr/local/bin/git installation. How can I modify my current PATH to use my $HOME/opt/bin/git without taking away /usr/local/bin/git?

Here is my current ~/.bash_profile: export PATH=/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/bin/

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The directories listed in the PATH environment variable are searched from first to last (left to right) when running external programs.

For your purpose you will want to have "$HOME"/opt/bin before (to the left of) /usr/local/bin. If your PATH value was constructed like this:

export PATH=/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/bin/

then you could use this instead:

export PATH="$HOME"/opt/bin:/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/local/bin:/bin:/usr/bin/

(i.e. have "$HOME"/opt/bin be the very first PATH entry).

share|improve this answer
    
Aha! That did it. Thank you very much. –  Yakattak Aug 17 '10 at 4:17
add comment

Try adding :$HOME/opt/bin/git to the path.

share|improve this answer
    
No dice :(, results in: -jailshell-3.2$ nano ~/.bash_profile -jailshell-3.2$ source ~/.bash_profile -jailshell-3.2$ which git /usr/local/bin/git –  Yakattak Aug 17 '10 at 1:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.