Bash: Luhn help

whats wrong with my script?

#!/usr/bin/env bash

declare input="$@"

[ "${#input}" -le 1 ] && { echo false; exit; }

input="${input// /}"

[[ "$input" =~ ^[0-9]+$ ]] || { echo false; exit; }

declare -i counter=0

declare -i sum=0

declare -i digit=0

while [ "$counter" -lt "${#input}" ]; do
        digit=${input:$counter:1}
        ((counter++%2 == 0)) && { ((digit+digit > 9)) && ((sum+=digit+digit-9)) || ((sum+=digit+digit)); } || \
        ((sum+=digit))
done

((sum%10 == 0)) && echo true || echo false

Locally I can pass most tests but when Im run testing in exercism Im failing 5 tests only about SIN. I followed all the instructions and examples in the question.

  1. How are you running the tests locally!?
  2. What failures are you seeing when you run the tests on the website? (Please don’t use images to show us.)