1

Basically, what the title says. I'm setting up a new version of LUA and HAProxy under my user account in Redhat, so the bin directory that contains it is /home/user1/testing/usr/local/bin. I've tried adding this to the PATH in my existing .profile, and .bash_profile files, but when I use which lua, I still get the older version under /usr/bin, in the root directory.

My path looks like this:

echo $PATH
/usr/local/bin:/usr/bin:/home/user1/testing/usr/local/bin/

Is there any way for me to do this without overwriting all the other commands?

3

The order of directories in $PATH is significant. When you run command, that will execute the first instance of command found in the directories of your $PATH. Since you have added the new directory at the end, and there is another executable with the same name in an earlier directory, that is the one you find.

So just change the order. I am guessing you have added something like this to your ~/.profile:

PATH="$PATH":/home/user1/testing/usr/local/bin/

You need to change it to this:

PATH=/home/user1/testing/usr/local/bin/:"$PATH"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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