From 25caa183012e74ad6045065b019ce29cfb2c7b6d Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 2 Jun 2015 11:48:55 +1200 Subject: Handle empty password dirs --- bash/bashrc.d/pass.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bash/bashrc.d') 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 -- cgit v1.2.3