In Bash, how do I declare a local integer variable, i.e. something like:
func() {
local ((number = 0)) # I know this does not work
local declare -i number=0 # this doesn't work either
# other statements, possibly modifying number
}
Somewhere I saw local -i number=0 being used, but this doesn’t look very portable.
Per http://www.gnu.org/software/bash/manual/bashref.html#Bash-Builtins,
So
local -iis valid.