diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-02 11:48:55 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-06-02 11:48:55 +1200 |
commit | 25caa183012e74ad6045065b019ce29cfb2c7b6d (patch) | |
tree | 1cee3f13fea6668c10647f395c630fb3843453ed /bash/bashrc.d | |
parent | Better variable name (diff) | |
download | dotfiles-25caa183012e74ad6045065b019ce29cfb2c7b6d.tar.gz dotfiles-25caa183012e74ad6045065b019ce29cfb2c7b6d.zip |
Handle empty password dirs
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/pass.bash | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bash/bashrc.d/pass.bash b/bash/bashrc.d/pass.bash index 2768d879..d60a6022 100644 --- a/bash/bashrc.d/pass.bash +++ b/bash/bashrc.d/pass.bash @@ -1,4 +1,4 @@ -# Requires Bash >= 4.0 for dotglob and globstar +# Requires Bash >= 4.0 for dotglob, nullglob, and globstar if ((10#${BASH_VERSINFO[0]%%[![:digit:]]*} < 4)) ; then return fi @@ -19,7 +19,7 @@ _pass() local word=${COMP_WORDS[COMP_CWORD]} local entry while read -d '' -r entry ; do - if [[ $entry == "$word"* ]] ; then + if [[ $entry && $entry == "$word"* ]] ; then COMPREPLY=("${COMPREPLY[@]}" "$entry") fi @@ -28,6 +28,7 @@ _pass() # Set shell options to expand globs the way we expect shopt -u dotglob + shopt -s nullglob shopt -s globstar # Change into password directory, or bail |