diff options
-rw-r--r-- | bash/bashrc.d/keep.bash | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bash/bashrc.d/keep.bash b/bash/bashrc.d/keep.bash index 6295069d..c71a80a9 100644 --- a/bash/bashrc.d/keep.bash +++ b/bash/bashrc.d/keep.bash @@ -114,11 +114,15 @@ EOF fi # Otherwise the user must want us to print all the NAMEs kept - local -a keeps - keeps=("${bashkeep}"/*.bash) - keeps=("${keeps[@]##*/}") - keeps=("${keeps[@]%.bash}") - printf '%s\n' "${keeps[@]}" + ( + shopt -s dotglob nullglob + declare -a keeps + keeps=("${bashkeep}"/*.bash) + keeps=("${keeps[@]##*/}") + keeps=("${keeps[@]%.bash}") + ((${keeps[@]})) || exit 0 + printf '%s\n' "${keeps[@]}" + ) } # Complete calls to keep with existing function names and variable names |