diff --git a/scripts/env/cd b/scripts/env/cd index ea1d195..b7d1a4b 100644 --- a/scripts/env/cd +++ b/scripts/env/cd @@ -18,8 +18,8 @@ fi if __gvm_is_function cd; then eval "$(echo "__gvm_oldcd()"; declare -f cd | sed '1 s/{/\'$'\n''{/' | tail -n +2)" -elif [[ "$(builtin type cd)" == "cd is a shell builtin" ]]; then - eval "$(echo "__gvm_oldcd() { builtin cd \$*; return \$?; }")" +elif [[ "$(builtin type -t cd 2>/dev/null)" == builtin ]]; then + eval "$(echo "__gvm_oldcd() { if [ \"\$#\" -eq 0 ]; then builtin cd; return \$?; else builtin cd \"\$@\"; return \$?; fi }")" fi # Path cleanup @@ -46,7 +46,9 @@ export PATH="$(__gvm_munge_path)" cd() { # @FIXME: gvm_oldcd is broken on re-sourcing .bashrc! if __gvm_is_function __gvm_oldcd; then - __gvm_oldcd $* + __gvm_oldcd "$@" || return $? + else + builtin cd "$@" || return $? fi local dot_go_version dot_go_pkgset rslt