From 3f564e8caaccb2d420f81151779c58e59a61766b Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 21 Nov 2011 17:42:02 -0800 Subject: [PATCH] fix cd function --- zsh/zshrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zsh/zshrc b/zsh/zshrc index 29329f3..4a115db 100755 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -293,10 +293,12 @@ alias em='emacsclient' # `cd /path/to/a/file` does `cd /path/to/a` function cd () { - if [[ -f $1 ]]; then - builtin cd $1:h + if [[ -f "$1" ]]; then + builtin cd "${1:h}" + elif [[ "$1" = "" ]]; then + builtin cd else - builtin cd $1 + builtin cd "$1" fi }