I am doing some timezone calculations in bash. I'm getting some unexpected values when converting the timezone offset hour output to an integer to do some additional calculations.
Partial script:
offset=$(date +%z) echo "$offset" hours=$(( offset )) echo "$hours" Output
-0400 -256 Desired Output (I accidentally omitted the need to divide by 100 for the final output)
-0400 -4 I think that the arithmetic is getting evaluated as octal. How can I evaluate the output from date +%z as decimal?