Increment variable in bash an math in general
How to increment a variable in bash? - Ask Ubuntu
var=$((var + 1)) is the most portable one.
Redirecting stdout and stderr in bash
some_command >file.log 2>&1 is the only one that works for me in all cases. (shell - Redirect stderr and stdout in Bash - Stack Overflow)
Bash arbitrary number of arguments and their number
"$@" are the arguments one can iterate through, and
"@#" is their number.