From 0b5e16add3b5d9bd3608804b786d43afc5640ce0 Mon Sep 17 00:00:00 2001 From: native-api Date: Sat, 29 Oct 2022 23:08:02 +0300 Subject: [PATCH] Fix invalid syntax error in `pyenv init -` if PYENV_ROOT has spaces (#2506) --- libexec/pyenv-init | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libexec/pyenv-init b/libexec/pyenv-init index f3b0f38b..24ef3b16 100755 --- a/libexec/pyenv-init +++ b/libexec/pyenv-init @@ -155,7 +155,11 @@ function print_path() { # (SSH provides /etc/ssh/sshrc and ~/.ssh/rc for that but no-one seems to use them for some reason). # This has caused an infinite `bashrc` execution loop for those people in the below nested Bash invocation (#2367). # --norc negates this behavior of such a customized Bash. - echo 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); for i in ${!paths[@]}; do if [[ ${paths[i]} == "'\'"${PYENV_ROOT}/shims"\''" ]]; then unset '\'\\\'\''paths[i]'\'\\\'\''; fi; done; echo "${paths[*]}"'\'')"' + echo 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); ' + echo 'for i in ${!paths[@]}; do ' + echo 'if [[ ${paths[i]} == "'\'\'"${PYENV_ROOT}/shims"\'\''" ]]; then unset '\'\\\'\''paths[i]'\'\\\'\''; ' + echo 'fi; done; ' + echo 'echo "${paths[*]}"'\'')"' echo 'export PATH="'"${PYENV_ROOT}"'/shims:${PATH}"' ;; esac