Bash interprets numbers with leading zeroes as being in octal, so it throws an error if you have more than 7 timezones and resets the sort count to zero.
That line should be sortkey=$(printf "%03d" $(( 10#$sortkey + 1 )))
The 10# tells bash to interpret the numbers in base 10.
Reported in the forum
Bash interprets numbers with leading zeroes as being in octal, so it throws an error if you have more than 7 timezones and resets the sort count to zero.
That line should be sortkey=$(printf "%03d" $(( 10#$sortkey + 1 )))
The 10# tells bash to interpret the numbers in base 10.