Skip to content

Commit

Permalink
Update the cd script to work with directory names that include spaces
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yithian committed Jul 18, 2024
1 parent dd65253 commit 938c9db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/env/cd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 938c9db

Please sign in to comment.