LanguagesNamedAfterCofee
LanguagesNamedAfterCofee

Reputation: 5952

Unix PATH override commands

Let's say my PATH="/usr/bin ... /root/.rbenv/shims"

I have an executable (ruby) in /usr/bin and /root/.rbenv/shims. How would I make the ruby in /root/.rbenv/shims be called?

Upvotes: 5

Views: 7907

Answers (2)

Marc B
Marc B

Reputation: 360782

Use an absolute path:

$ /root/.rbenv/shims/ruby ...

If you're doing this from a shell script, then use

#!/root/.rbenc/shims/ruby

as the shebang

Upvotes: 1

sarnold
sarnold

Reputation: 104080

Put /root/.rbenv/shims first in your PATH:

export PATH=/root/.rbenv/SHIMS:$PATH

(Before running this command, you must be sure PATH already exists -- if it doesn't, it adds the current working directory to your PATH as well, which is almost always a mistake.)

Upvotes: 11

Related Questions