fix cd function

This commit is contained in:
Sami Samhuri 2011-11-21 17:42:02 -08:00
parent e1a44f14a6
commit 3f564e8caa

View file

@ -293,10 +293,12 @@ alias em='emacsclient'
# `cd /path/to/a/file` does `cd /path/to/a` # `cd /path/to/a/file` does `cd /path/to/a`
function cd () { function cd () {
if [[ -f $1 ]]; then if [[ -f "$1" ]]; then
builtin cd $1:h builtin cd "${1:h}"
elif [[ "$1" = "" ]]; then
builtin cd
else else
builtin cd $1 builtin cd "$1"
fi fi
} }