summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2012-01-01 14:46:59 +0200
committerVille Skyttä <ville.skytta@iki.fi>2012-01-01 14:46:59 +0200
commitfabf0e2d353188819edb21111ad485b0d051e5d0 (patch)
tree0baab7d922937a01ed456db4dd8fa811b2b14e7c
parentd4416accccb7be5efa8690a3e703ad91a6c02eac (diff)
downloadbash-completion-fabf0e2d353188819edb21111ad485b0d051e5d0.tar.gz
Some trivial nounset error fixes.
-rw-r--r--bash_completion23
1 files changed, 13 insertions, 10 deletions
diff --git a/bash_completion b/bash_completion
index 99addfd2..51c8a139 100644
--- a/bash_completion
+++ b/bash_completion
@@ -32,7 +32,7 @@ else
BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
fi
-if [[ -n $BASH_COMPLETION_DEBUG ]]; then
+if [[ ${BASH_COMPLETION_DEBUG-} ]]; then
set -v
else
set +v
@@ -40,7 +40,7 @@ fi
# Set the following to the location of the backwards compat completion dir.
#
-[ -n "$BASH_COMPLETION_COMPAT_DIR" ] || BASH_COMPLETION_COMPAT_DIR=/etc/bash_completion.d
+: ${BASH_COMPLETION_COMPAT_DIR:=/etc/bash_completion.d}
readonly BASH_COMPLETION_COMPAT_DIR
# Blacklisted completions, causing problems with our code.
@@ -590,10 +590,11 @@ _filedir()
-n "$1" && "$1" != -d && ${#toks[@]} -lt 1 ]] && \
toks+=( $( compgen -f -- $quoted ) )
- # 2>/dev/null for direct invocation, e.g. in the _filedir unit test
- [[ ${#toks[@]} -ne 0 ]] && compopt -o filenames 2>/dev/null
-
- COMPREPLY+=( "${toks[@]}" )
+ if [[ ${#toks[@]} -ne 0 ]]; then
+ # 2>/dev/null for direct invocation, e.g. in the _filedir unit test
+ compopt -o filenames 2>/dev/null
+ COMPREPLY+=( "${toks[@]}" )
+ fi
} # _filedir()
@@ -647,7 +648,7 @@ _variables()
#
_init_completion()
{
- local exclude flag outx errx inx OPTIND=1
+ local exclude= flag outx errx inx OPTIND=1
while getopts "n:e:o:i:s" flag "$@"; do
case $flag in
@@ -709,7 +710,7 @@ _init_completion()
[[ $cword -eq 0 ]] && return 1
prev=${words[cword-1]}
- [[ $split ]] && _split_longopt && split=true
+ [[ ${split-} ]] && _split_longopt && split=true
return 0
}
@@ -1829,8 +1830,10 @@ _filedir_xspec()
}
))
- [[ ${#toks[@]} -ne 0 ]] && compopt -o filenames
- COMPREPLY=( "${toks[@]}" )
+ if [[ ${#toks[@]} -ne 0 ]]; then
+ compopt -o filenames
+ COMPREPLY=( "${toks[@]}" )
+ fi
}
_install_xspec()