mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Guard against nonexistent entries in $PATH
This commit is contained in:
parent
bd1e56ff37
commit
3efdf6a243
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,10 @@
|
|||
set -e
|
||||
|
||||
expand_path() {
|
||||
if [ ! -d "$1" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cwd="$(pwd)"
|
||||
cd "$1"
|
||||
pwd
|
||||
|
@ -14,7 +18,7 @@ remove_from_path() {
|
|||
|
||||
for path in ${PATH//:/$'\n'}; do
|
||||
path="$(expand_path "$path" || true)"
|
||||
if [ "$path" != "$path_to_remove" ]; then
|
||||
if [ -n "$path" ] && [ "$path" != "$path_to_remove" ]; then
|
||||
result="${result}${path}:"
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue