aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/sd.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-01 02:29:42 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-01 02:29:42 +1300
commit0681de59778f82c9006de70ed9a9ee6644fd4a18 (patch)
tree1bba07ac51710494c17920f553dea26a69df55d0 /bash/bash_completion.d/sd.bash
parentRemove unneeded quoting in case statement (diff)
downloaddotfiles-0681de59778f82c9006de70ed9a9ee6644fd4a18.tar.gz
dotfiles-0681de59778f82c9006de70ed9a9ee6644fd4a18.zip
Adjust loop short circuits and pattern matches
Diffstat (limited to 'bash/bash_completion.d/sd.bash')
-rw-r--r--bash/bash_completion.d/sd.bash10
1 files changed, 7 insertions, 3 deletions
diff --git a/bash/bash_completion.d/sd.bash b/bash/bash_completion.d/sd.bash
index 2d2d8f22..1194b33a 100644
--- a/bash/bash_completion.d/sd.bash
+++ b/bash/bash_completion.d/sd.bash
@@ -5,7 +5,9 @@ _sd() {
((COMP_CWORD == 1)) || return 1
# Current directory can't be root directory
- [[ $PWD != / ]] || return 1
+ case $PWD in
+ /) return 1 ;;
+ esac
# Build list of matching sibling directories
local dirname
@@ -37,8 +39,10 @@ _sd() {
local -a sibs
local dirname
for dirname in "${dirnames[@]}" ; do
- [[ $dirname != "${PWD##*/}" ]] || continue
- sibs[${#sibs[@]}]=$dirname
+ case $dirname in
+ "${PWD##*/}") ;;
+ *) sibs[${#sibs[@]}]=$dirname ;;
+ esac
done
# Print quoted sibling directories, null-delimited