Use numeric comparison operators when comparing numerically.
This commit is contained in:
parent
6042cbe2f5
commit
344076f92c
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 | \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
} &&
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user