[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-11-g344076f

Ville Skyttä ville.skytta at iki.fi
Thu Feb 10 21:55:33 UTC 2011


The following commit has been merged in the master branch:
commit 344076f92c4f1514b56d236b81fc06d108114c2e
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Feb 10 23:55:16 2011 +0200

    Use numeric comparison operators when comparing numerically.

diff --git a/completions/coreutils b/completions/coreutils
index 33d58cf..0e0b759 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 0556f3d..cd53f3e 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 b8aaa57..1fb330c 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 d703019..7b099d0 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 1311c98..6492948 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 3b309a9..0391efa 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 f45ffd5..918363a 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 abc0ff2..0348cc6 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list