mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Expand literal tilde in PATH
The literal tilde in a PATH entry (e.g. `~/.rbenv/shims`) doesn't seem to be supported by system `which` utility, but *does* seem to be supported by `command -v` (used in `rbenv-which`) and `type -p`. Therefore, we must strip away `~/.rbenv/shims` from PATH when looking up executables for system Ruby, lest we risk infinite loop. We do so by substituting any occurence of `~` in PATH with the value of `HOME`.
This commit is contained in:
parent
0c7224af95
commit
d0779fc8fb
1 changed files with 1 additions and 1 deletions
|
@ -18,7 +18,7 @@ fi
|
|||
remove_from_path() {
|
||||
local path_to_remove="$1"
|
||||
local path_before
|
||||
local result=":$PATH:"
|
||||
local result=":${PATH//\~/$HOME}:"
|
||||
while [ "$path_before" != "$result" ]; do
|
||||
path_before="$result"
|
||||
result="${result//:$path_to_remove:/:}"
|
||||
|
|
Loading…
Reference in a new issue