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?
The PATH environment variable is a colon-delimited list of directories that your shell searches through when you enter a command. Program files (executables) are kept in many different places on the Unix system. Your path tells the Unix shell where to look on the system when you request a particular program.
We can add a new path for all users on a Unix-like system by creating a file ending in . sh in /etc/profile. d/ and adding our export command to this file. All of the scripts in /etc/profile.
For Bash, you simply need to add the line from above, export PATH=$PATH:/place/with/the/file, to the appropriate file that will be read when your shell launches. There are a few different places where you could conceivably set the variable name: potentially in a file called ~/. bash_profile, ~/.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With