diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2013-07-21 18:35:44 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2013-07-21 18:35:44 +1200 |
commit | 8390d937cb3d642ddfcd2de1357e20703f7f7e9e (patch) | |
tree | 3924ad4bf6994cbb023aa5043f65a97dae493723 /bash/bashrc.d/cd.bash | |
parent | Remove trailing spaces before closing parentheses (diff) | |
download | dotfiles-8390d937cb3d642ddfcd2de1357e20703f7f7e9e.tar.gz dotfiles-8390d937cb3d642ddfcd2de1357e20703f7f7e9e.zip |
Cleaner argument count tests in cd function
Diffstat (limited to 'bash/bashrc.d/cd.bash')
-rw-r--r-- | bash/bashrc.d/cd.bash | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/bash/bashrc.d/cd.bash b/bash/bashrc.d/cd.bash index a07f07b9..79e610d8 100644 --- a/bash/bashrc.d/cd.bash +++ b/bash/bashrc.d/cd.bash @@ -6,12 +6,10 @@ function cd { local opts="$opts -$opt" done shift $(($OPTIND-1)) - if [[ -n "$2" ]]; then + if [[ $# -eq 2 ]]; then builtin cd $opts "${PWD/$1/$2}" - elif [[ -n "$1" ]]; then - builtin cd $opts "$1" else - builtin cd $opts + builtin cd $opts "$@" fi } |