fix cd function
This commit is contained in:
parent
e1a44f14a6
commit
3f564e8caa
1 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue