aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/man.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/man.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/man.bash')
-rw-r--r--bash/bash_completion.d/man.bash10
1 files changed, 7 insertions, 3 deletions
diff --git a/bash/bash_completion.d/man.bash b/bash/bash_completion.d/man.bash
index fcf26436..7574db40 100644
--- a/bash/bash_completion.d/man.bash
+++ b/bash/bash_completion.d/man.bash
@@ -17,9 +17,13 @@ _man() {
# If this is the second word, and the previous word started with a number,
# we'll assume that's the section to search
local section subdir
- if ((COMP_CWORD > 1)) && [[ ${COMP_WORDS[COMP_CWORD-1]} == [0-9]* ]] ; then
- section=${COMP_WORDS[COMP_CWORD-1]}
- subdir=man${section%%[^0-9]*}
+ if ((COMP_CWORD > 1)) ; then
+ case ${COMP_WORDS[COMP_CWORD-1]} in
+ [0-9]*)
+ section=${COMP_WORDS[COMP_CWORD-1]}
+ subdir=man${section%%[^0-9]*}
+ ;;
+ esac
fi
# Read completion results from a subshell and add them to the COMPREPLY