diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-04 12:55:18 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-04 12:55:18 +1200 |
commit | f06a44231a91ba3561c9492c1e31b1c30c165130 (patch) | |
tree | fd1f2f72a65ae56c5dc0c4a07319c292d8433a5c /bash/bashrc.d/vr.bash | |
parent | Correct argument test in bd() and prompt() (diff) | |
download | dotfiles-f06a44231a91ba3561c9492c1e31b1c30c165130.tar.gz dotfiles-f06a44231a91ba3561c9492c1e31b1c30c165130.zip |
Use consistent [[ syntax
Explicit -n, ! within [[
Diffstat (limited to 'bash/bashrc.d/vr.bash')
-rw-r--r-- | bash/bashrc.d/vr.bash | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bash/bashrc.d/vr.bash b/bash/bashrc.d/vr.bash index 150861a8..fc1de5ef 100644 --- a/bash/bashrc.d/vr.bash +++ b/bash/bashrc.d/vr.bash @@ -4,17 +4,17 @@ vr() { path=${path%/} # Raise some helpful errors - if ! [[ -e $path ]] ; then + if [[ ! -e $path ]] ; then printf 'bash: %s: %s: No such file or directory\n' \ "$FUNCNAME" "$path" return 1 fi - if ! [[ -d $path ]] ; then + if [[ ! -d $path ]] ; then printf 'bash: %s: %s: Not a directory\n' \ "$FUNCNAME" "$path" return 1 fi - if ! [[ -x $path ]] ; then + if [[ ! -x $path ]] ; then printf 'bash: %s: %s: Permission denied\n' \ "$FUNCNAME" "$path" return 1 @@ -22,14 +22,14 @@ vr() { # Ask Git the top level local git_root=$(cd -- "$path" && git rev-parse --show-toplevel 2>/dev/null) - if [[ $git_root ]] ; then + if [[ -n $git_root ]] ; then cd -- "$git_root" return fi # Ask Mercurial the top level local hg_root=$(cd -- "$path" && hg root 2>/dev/null) - if [[ $hg_root ]] ; then + if [[ -n $hg_root ]] ; then cd -- "$hg_root" return fi @@ -38,7 +38,7 @@ vr() { # doesn't; hopefully that's the root if [[ -d $path/.svn ]] ; then local search=$path - while [[ $search ]] ; do + while [[ -n $search ]] ; do if [[ -d ${search%/*}/.svn ]] ; then search=${search%/*} else |