Skip to content

Commit 938c9db

Browse files
committed
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
1 parent dd65253 commit 938c9db

File tree

1 file changed

+1
-1
lines changed
  • scripts/env

1 file changed

+1
-1
lines changed

scripts/env/cd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fi
1919
if __gvm_is_function cd; then
2020
eval "$(echo "__gvm_oldcd()"; declare -f cd | sed '1 s/{/\'$'\n''{/' | tail -n +2)"
2121
elif [[ "$(builtin type cd)" == "cd is a shell builtin" ]]; then
22-
eval "$(echo "__gvm_oldcd() { builtin cd \$*; return \$?; }")"
22+
eval "$(echo "__gvm_oldcd() { if [[ -z \"\$*\" ]]; then builtin cd; return \$?; else builtin cd \"\$*\"; return \$?; fi }")"
2323
fi
2424

2525
# Path cleanup

0 commit comments

Comments
 (0)