EDIT: I think that it's not picking up the $1 as the operand. I tried storing it in a variable, then trying the assignment but it seems that has no effect.
EDIT 2: provided a minimal reproducible script as requested.
The error generating part of the code is the following:
check() {
if [ $1 -lt $2 ]; then
for((var=$1; var<$2; var++)); do
if [ $((var%2)) -eq 0 ]; then
echo "it's an even number"
fi
done
fi
}
if [ $# -eq 2 ]; then
check
fi
the rest of the function's code will be attached below. The function is rather long to re-type out; I'm using ubuntu through a VM which doesn't allow for items to be copied into or pasted out of the VM, but this just may be a settings thing.
$1when it fails? Addset -xto your script to observe each statement, and each variable.