2

I installed rbenv, a ruby version management program. I looked in the .bashrc file and noticed that the path variable was changed as below:

export PATH="$HOME/.rbenv/bin:$PATH"

I think the ":$PATH" part was included to include the old path contents. I would like to know what would happen if a program that modifies the path variable doesn't include the ":$PATH" part. Would I not be able to run some programs from the command line since the bin directories in which they reside are no longer included in the new path variable?

2

You are correct. Third party packages should therefore only extend the current path, not limit it.

1

PATH is a colon separated list of directories that your shell (bash, fish,ksh,sh, etc) uses to find something to execute. If the first word of the line you type to the shell is not a Shell builtin or alias, the shell steps through the list of directories in $PATH, looking for an executable file with the same name as the first word of the command you typed.

command not found errors for common commands (da/media/w3/0123-4567/PODCASTS/2016-Nov-27/loe-wildlife-decline.mp3te, ls, ...) is indicitive of a malformed PATH. An emergency PATH (enough to let you fix the problem can be set with export PATH=/usr/bin:/bin:/usr/local/bin:/snap/bin.

Many PATH errors are shell syntax errors (Space before or after =. It's PATH=value, no spaces).

As far as "path corruption", if I have created a "special" version of ls, stored in /.evil/bin/ls, AND I can corrupt your path so that it has /.evil/bin BEFORE /bin, when you type ls, the shell will run /.evil/bin/ls instead of /bin/ls. A Well Known Gotcha, but your system is thoroughly penetrated by the time it becomes useful.

0

You would be able to run them, you will just have to specify the full path. Modifying PATH does not modify the permissions associated.

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.