Question: what does this line do? Can someone please explain?  if [ $((${array[$i]}+1)) -ne ${array[$(($i + 1))]} ] ;then foo; fi
compare array in bash
bash;array
[ ... -ne ... ] - test for inequality$(( ... + 1)) - add one, arithmetic expansion${array[$i]} - reference to element $i of an array variableOr in other words the test is A[i] + 1 != A[i + 1]