diff --git a/bash_completion b/bash_completion index 6eaed94ac2d..dc8207a4dcb 100644 --- a/bash_completion +++ b/bash_completion @@ -624,7 +624,7 @@ _filedir() local opts=(-f -X "$xspec") [[ $xspec ]] && plusdirs=(-o plusdirs) [[ ${BASH_COMPLETION_FILEDIR_FALLBACK-${COMP_FILEDIR_FALLBACK-}} || - -z ${plusdirs-} ]] || + ! ${plusdirs-} ]] || opts+=("${plusdirs[@]}") reset=$(shopt -po noglob) @@ -636,7 +636,7 @@ _filedir() # Try without filter if it failed to produce anything and configured to [[ ${BASH_COMPLETION_FILEDIR_FALLBACK-${COMP_FILEDIR_FALLBACK-}} && - -n $arg && ${#toks[@]} -lt 1 ]] && { + $arg && ${#toks[@]} -lt 1 ]] && { reset=$(shopt -po noglob) set -o noglob toks+=($(compgen -f ${plusdirs+"${plusdirs[@]}"} -- $quoted)) @@ -1567,7 +1567,7 @@ _fstypes() $([[ -d /etc/fs ]] && command ls /etc/fs)" fi - [[ -n $fss ]] && COMPREPLY+=($(compgen -W "$fss" -- "$cur")) + [[ $fss ]] && COMPREPLY+=($(compgen -W "$fss" -- "$cur")) } # Get real command. @@ -1952,7 +1952,7 @@ _known_hosts_real() # Add results of normal hostname completion, unless # `BASH_COMPLETION_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value. - if [[ -n ${BASH_COMPLETION_KNOWN_HOSTS_WITH_HOSTFILE-${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}} ]]; then + if [[ ${BASH_COMPLETION_KNOWN_HOSTS_WITH_HOSTFILE-${COMP_KNOWN_HOSTS_WITH_HOSTFILE-1}} ]]; then COMPREPLY+=( $(compgen -A hostname -P "$prefix" -S "$suffix" -- "$cur")) fi @@ -1993,7 +1993,7 @@ _cd() # Use standard dir completion if no CDPATH or parameter starts with /, # ./ or ../ - if [[ -z ${CDPATH:-} || $cur == ?(.)?(.)/* ]]; then + if [[ ! ${CDPATH:-} || $cur == ?(.)?(.)/* ]]; then _filedir -d return fi @@ -2136,7 +2136,7 @@ _command_offset() # Note: When completion spec is removed after 124, we do # not generate any completions including the default ones. # This is the behavior of the original Bash progcomp. - [[ -n $cspec ]] || break + [[ $cspec ]] || break continue fi @@ -2267,7 +2267,7 @@ _filedir_xspec() toks+=($( eval compgen -f -X "'!$xspec'" -- '$(quote_readline "$cur")' | { while read -r tmp; do - [[ -n $tmp ]] && printf '%s\n' $tmp + [[ $tmp ]] && printf '%s\n' $tmp done } )) @@ -2372,7 +2372,7 @@ __load_completion() { local -a dirs=(${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions) local IFS=: dir cmd="${1##*/}" compfile - [[ -n $cmd ]] || return 1 + [[ $cmd ]] || return 1 for dir in ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do dirs+=($dir/bash-completion/completions) done diff --git a/completions/_mount b/completions/_mount index ca5df25b3d4..3ab57e29a86 100644 --- a/completions/_mount +++ b/completions/_mount @@ -42,7 +42,7 @@ _mount() if [[ $cur == //* ]]; then host=${cur#//} host=${host%%/*} - if [[ -n $host ]]; then + if [[ $host ]]; then COMPREPLY=($(compgen -P "//$host" -W \ "$(smbclient -d 0 -NL $host 2>/dev/null | command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | diff --git a/completions/_mount.linux b/completions/_mount.linux index 39100bb55e2..e529b62e803 100644 --- a/completions/_mount.linux +++ b/completions/_mount.linux @@ -236,7 +236,7 @@ _mount() if [[ $cur == //* ]]; then host=${cur#//} host=${host%%/*} - if [[ -n $host ]]; then + if [[ $host ]]; then COMPREPLY=($(compgen -P "//$host" -W \ "$(smbclient -d 0 -NL $host 2>/dev/null | command sed -ne '/^[[:blank:]]*Sharename/,/^$/p' | diff --git a/completions/abook b/completions/abook index 42197d10d8f..349a8167eb7 100644 --- a/completions/abook +++ b/completions/abook @@ -6,7 +6,7 @@ _abook() _init_completion || return # abook only takes options, tabbing after command name adds a single dash - [[ $cword -eq 1 && -z $cur ]] && + [[ $cword -eq 1 && ! $cur ]] && { compopt -o nospace COMPREPLY=("-") diff --git a/completions/carton b/completions/carton index 5d700c8903f..d92467e02c9 100644 --- a/completions/carton +++ b/completions/carton @@ -39,7 +39,7 @@ _carton() return ;; --help | -h) - [[ -n $command ]] || _carton_commands "$1" + [[ $command ]] || _carton_commands "$1" return ;; --cpanfile) diff --git a/completions/cppcheck b/completions/cppcheck index 8ea9571536d..01cd1138c6e 100644 --- a/completions/cppcheck +++ b/completions/cppcheck @@ -35,7 +35,7 @@ _cppcheck() ;; --file-list) _filedir - [[ -z $cur || $cur == - ]] && COMPREPLY+=(-) + [[ ! $cur || $cur == - ]] && COMPREPLY+=(-) return ;; -I) diff --git a/completions/cryptsetup b/completions/cryptsetup index e73e165e8a2..7a97dfd86ea 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -35,7 +35,7 @@ _cryptsetup() local arg _get_first_arg - if [[ -z $arg ]]; then + if [[ ! $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) [[ ${COMPREPLY-} == *= ]] && compopt -o nospace diff --git a/completions/cvs b/completions/cvs index 83ce0d539a8..5ed71269abe 100644 --- a/completions/cvs +++ b/completions/cvs @@ -13,7 +13,7 @@ _cvs_entries() _cvs_modules() { - if [[ -n $prefix ]]; then + if [[ $prefix ]]; then COMPREPLY=($(command ls -d ${cvsroot}/${prefix}/!(CVSROOT))) else COMPREPLY=($(command ls -d ${cvsroot}/!(CVSROOT))) @@ -152,7 +152,7 @@ _cvs() if [[ $cur != -* ]]; then _cvs_entries - [[ -z $cur ]] && files=(!(CVS)) || + [[ ! $cur ]] && files=(!(CVS)) || files=($(command ls -d ${cur}* 2>/dev/null)) local f for i in "${!files[@]}"; do @@ -251,7 +251,7 @@ _cvs() # if $BASH_COMPLETION_CMD_CVS_REMOTE is not null, 'cvs commit' # will complete on remotely checked-out files (requires # passwordless access to the remote repository - if [[ -n ${BASH_COMPLETION_CMD_CVS_REMOTE-${COMP_CVS_REMOTE-}} ]]; then + if [[ ${BASH_COMPLETION_CMD_CVS_REMOTE-${COMP_CVS_REMOTE-}} ]]; then # this is the least computationally intensive way found so # far, but other changes (something other than # changed/removed/new) may be missing diff --git a/completions/dict b/completions/dict index f3426ffd201..7e8396da501 100644 --- a/completions/dict +++ b/completions/dict @@ -17,15 +17,15 @@ _dict() case ${words[i]} in --host | -!(-*)h) host=${words[++i]} - [[ -n $host ]] && host="-h $host" + [[ $host ]] && host="-h $host" ;; --port | -!(-*)p) port=${words[++i]} - [[ -n $port ]] && port="-p $port" + [[ $port ]] && port="-p $port" ;; --database | -!(-*)d) db=${words[++i]} - [[ -n $db ]] && host="-d $db" + [[ $db ]] && host="-d $db" ;; esac done diff --git a/completions/ebtables b/completions/ebtables index de6bc54964f..0a0042de737 100644 --- a/completions/ebtables +++ b/completions/ebtables @@ -20,7 +20,7 @@ _ebtables() COMPREPLY=($(compgen -W 'nat filter broute' -- "$cur")) ;; -!(-*)j) - if [[ $table == "-t filter" || -z $table ]]; then + if [[ $table == "-t filter" || ! $table ]]; then COMPREPLY=($(compgen -W '$targets $("$1" $table -L 2>/dev/null | \ command sed -n -e "s/INPUT\|OUTPUT\|FORWARD//" \ diff --git a/completions/hcitool b/completions/hcitool index 7c5b4afb426..13fcfef592a 100644 --- a/completions/hcitool +++ b/completions/hcitool @@ -2,7 +2,7 @@ _bluetooth_addresses() { - if [[ -n ${COMP_BLUETOOTH_SCAN:-} ]]; then + if [[ ${COMP_BLUETOOTH_SCAN:-} ]]; then COMPREPLY+=($(compgen -W "$(hcitool scan | awk '/^\t/{print $1}')" -- "$cur")) fi @@ -51,7 +51,7 @@ _hcitool() local arg _get_first_arg - if [[ -z $arg ]]; then + if [[ ! $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else @@ -123,7 +123,7 @@ _sdptool() local arg _get_first_arg - if [[ -z $arg ]]; then + if [[ ! $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else @@ -207,7 +207,7 @@ _rfcomm() local arg _get_first_arg - if [[ -z $arg ]]; then + if [[ ! $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else @@ -247,7 +247,7 @@ _ciptool() local arg _get_first_arg - if [[ -z $arg ]]; then + if [[ ! $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur")) else @@ -305,7 +305,7 @@ _hciconfig() local arg _get_first_arg - if [[ -z $arg ]]; then + if [[ ! $arg ]]; then if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '--help --all' -- "$cur")) else diff --git a/completions/info b/completions/info index 7a179e63c30..cba5e8ea514 100644 --- a/completions/info +++ b/completions/info @@ -48,7 +48,7 @@ _info() fi infopath=$infopath: - if [[ -n $cur ]]; then + if [[ $cur ]]; then infopath="${infopath//://$cur* }" else infopath="${infopath//:// }" diff --git a/completions/iptables b/completions/iptables index ffb905b8da5..6c564f5a6ce 100644 --- a/completions/iptables +++ b/completions/iptables @@ -19,7 +19,7 @@ _iptables() COMPREPLY=($(compgen -W 'nat filter mangle' -- "$cur")) ;; -j) - if [[ $table == "-t filter" || -z $table ]]; then + if [[ $table == "-t filter" || ! $table ]]; then COMPREPLY=($(compgen -W 'ACCEPT DROP LOG ULOG REJECT `"$1" $table -nL 2>/dev/null | command sed -ne "$chain" \ -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ diff --git a/completions/java b/completions/java index d0f70ae6a6c..a26de1744d6 100644 --- a/completions/java +++ b/completions/java @@ -24,7 +24,7 @@ _java_find_classpath() [[ ! -v classpath ]] && classpath=${CLASSPATH-} # default to current directory - [[ -z $classpath ]] && classpath=. + [[ ! $classpath ]] && classpath=. } # exact sourcepath determination diff --git a/completions/make b/completions/make index 32e112c189e..fb86a45c02a 100644 --- a/completions/make +++ b/completions/make @@ -73,7 +73,7 @@ _make_target_extract_script() EOF # don't complete with hidden targets unless we are doing a partial completion - if [[ -z ${prefix_pat} || ${prefix_pat} == */ ]]; then + if [[ ! ${prefix_pat} || ${prefix_pat} == */ ]]; then cat <