-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest recommending editing of .profile, not .bashrc #97
Comments
thanks for the suggestion, that sounds good to me. wouldn't you also want things loaded for login shells, in which case |
I suspect there is some per-distribution variation here, but at least for Debian and Ubuntu, the default is e.g. from the bash man page:
In rustup we only edit |
Woudn't it be better to check if it's already in PYENV_PATH="$HOME/.pyenv/bin"
grep -E -q "(^|:)$PYENV_PATH($|:)" && PATH="$PATH:$PYENV_PATH" |
@alireza4050 doing it without invoking a subprocess would be ok I guess. I think the Google SDK has some array glue that does that in a nifty fashion. |
The following trick works to "grep" PATH without a subshell (afaik?) and is part of rust-lang/rustup#2387 #!/bin/sh
# rustup shell setup
# affix colons on either side of $PATH to simplify matching
case ":${PATH}:" in
*:"${cargo_bin}":*)
;;
*)
# Prepending path in case a system-installed rustc must be overwritten
export PATH="${cargo_bin}:${PATH}"
;;
esac |
The instructions have been moved into Pyenv's codebase and fixed in pyenv/pyenv#1920 |
~/.bashrc is invoked on every new shell, so the path changes are additive, whereas ~/.profile's contents only run once per session, which is why most PATH changes are done to ~/.profile.
When pyenv is added to the path in ~/.bashrc, running 4 or five nested bash shells will result in a path like this:
Which is clearly undesirable - in extreme cases this will cause errors when the environment block becomes exhausted, and even before then will cause performance issues as the same dir is searched again and again for commands.
The text was updated successfully, but these errors were encountered: