From 938c9db5fd5ec5418a7ee3f3e179d5005418d40c Mon Sep 17 00:00:00 2001 From: Alex Chvatal Date: Wed, 26 Jun 2024 10:03:06 -0400 Subject: [PATCH] Update the cd script to work with directory names that include spaces This patch updates the __gvm_oldcd function to handle directory arguments with spaces while also preserving the ability not to provide any arguments to cd to return to the home directory --- scripts/env/cd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/env/cd b/scripts/env/cd index ea1d1953..0e8ead23 100644 --- a/scripts/env/cd +++ b/scripts/env/cd @@ -19,7 +19,7 @@ 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 \$?; }")" + eval "$(echo "__gvm_oldcd() { if [[ -z \"\$*\" ]]; then builtin cd; return \$?; else builtin cd \"\$*\"; return \$?; fi }")" fi # Path cleanup