diff --git a/completions/coreutils b/completions/coreutils index 33d58cf7..0e0b759a 100644 --- a/completions/coreutils +++ b/completions/coreutils @@ -40,7 +40,7 @@ _chown() # The first argument is an usergroup; the rest are filedir. _count_args : - if [[ $args == 1 ]]; then + if [[ $args -eq 1 ]]; then _usergroup -u else _filedir diff --git a/completions/dpkg b/completions/dpkg index 0556f3d1..cd53f3e2 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -32,7 +32,7 @@ _dpkg() # find the last option flag if [[ $cur != -* ]]; then - while [[ $prev != -* && $i != 1 ]]; do + while [[ $prev != -* && $i -ne 1 ]]; do i=$((i-1)) prev=${COMP_WORDS[i-1]} done diff --git a/completions/findutils b/completions/findutils index b8aaa57a..1fb330c0 100644 --- a/completions/findutils +++ b/completions/findutils @@ -5,7 +5,7 @@ have find && _find() { - local cur prev i exprfound onlyonce + local cur prev i onlyonce COMPREPLY=() _get_comp_words_by_ref cur prev @@ -68,13 +68,15 @@ _find() esac _expand || return 0 - # set exprfound to 1 if there is already an expression present + + local exprfound=false + # set exprfound to true if there is already an expression present for i in ${COMP_WORDS[@]}; do - [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break + [[ "$i" = [-\(\),\!]* ]] && exprfound=true && break done # handle case where first parameter is not a dash option - if [[ "$exprfound" != 1 && "$cur" != [-\(\),\!]* ]]; then + if ! $exprfound && [[ "$cur" != [-\(\),\!]* ]]; then _filedir -d return 0 fi diff --git a/completions/jar b/completions/jar index d703019d..7b099d04 100644 --- a/completions/jar +++ b/completions/jar @@ -8,7 +8,7 @@ _jar() COMPREPLY=() _get_comp_words_by_ref cur - if [ $COMP_CWORD = 1 ]; then + if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=( $( compgen -W 'c t x u' -- "$cur" ) ) return 0 fi diff --git a/completions/postfix b/completions/postfix index 1311c987..64929488 100644 --- a/completions/postfix +++ b/completions/postfix @@ -102,7 +102,7 @@ _postcat() for idx in "${COMP_WORDS[@]}"; do [[ "$idx" = -q ]] && qfile=1 && break done - if [[ $qfile == 1 ]]; then + if [[ $qfile -eq 1 ]]; then len=${#cur} idx=0 for pval in $( mailq 2>/dev/null | \ diff --git a/completions/sysbench b/completions/sysbench index 3b309a9a..0391efaa 100644 --- a/completions/sysbench +++ b/completions/sysbench @@ -156,7 +156,7 @@ _sysbench() if [[ "$cur" == -* || ! $test ]]; then COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) - [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \ + [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \ compopt +o nospace &>/dev/null else compopt +o nospace &>/dev/null diff --git a/completions/util-linux b/completions/util-linux index f45ffd56..918363aa 100644 --- a/completions/util-linux +++ b/completions/util-linux @@ -61,7 +61,7 @@ _look() COMPREPLY=() _get_comp_words_by_ref cur - if [ $COMP_CWORD = 1 ]; then + if [[ $COMP_CWORD -eq 1 ]]; then COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) ) fi } && diff --git a/completions/wodim b/completions/wodim index abc0ff25..0348cc65 100644 --- a/completions/wodim +++ b/completions/wodim @@ -51,7 +51,7 @@ _cdrecord() gigarec= audiomaster forcespeed noforcespeed speedread nospeedread singlesession nosinglesession hidecdr nohidecdr tattooinfo tattoofile=' -- "$cur" ) ) - [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \ + [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \ compopt +o nospace &>/dev/null fi ;; @@ -104,7 +104,7 @@ _cdrecord() COMPREPLY=( "${COMPREPLY[@]}" \ $( compgen -W '${generic_options[@]}' -- "$cur" ) ) fi - [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != *= ]] && \ + [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \ compopt +o nospace &>/dev/null } && complete -F _cdrecord -o nospace cdrecord wodim