Allow leading zeros, but always treat it as decimal. Also quote right side of [[ expression ]] when the != or == operator is used, unless a pattern is intended. Signed-off-by: lolilolicon <lolilolicon@gmail.com> --- contrib/paccache.in | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/paccache.in b/contrib/paccache.in index 11b7bbb..c86ea31 100755 --- a/contrib/paccache.in +++ b/contrib/paccache.in @@ -153,7 +153,7 @@ summarize() { while read -r pkg; do if (( verbose >= 3 )); then [[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]} - if [[ -z $seen || $seenarch != $arch || $seen != $name ]]; then + if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then printf '%s (%s):\n' "$name" "$arch" fi printf ' %s\n' "$pkg" @@ -220,8 +220,10 @@ while getopts ':a:c:dfhi:k:m:rsuvz' opt; do blacklist+=("${ign[@]}") unset i ign ;; k) keep=$OPTARG - if [[ $keep != $OPTARG ]] || (( keep < 0 )); then + if [[ -z $keep || -n ${keep//[0-9]/} ]]; then die 'argument to option -k must be a non-negative integer' + else + keep=$(( 10#$keep )) fi ;; m) move=1 movedir=$OPTARG ;; r) delete=1 ;; -- 1.7.6.4