Quote:
$ a="08"
$ b="1"
$ c=$((a+b))
-sh: 08: value too great for base (error token is "08")
$ a="09"
$ b="1"
$ c=$((a+b))
-sh: 09: value too great for base (error token is "09")
|
Prefacing a number with 0 makes it octal. Your problem is that octal uses units of 8, expressed as the range 0-7, so 08 is plain nonsense. Decimal 8 would be octal (0)10 and decimal 9 would be octal (0)11.
echo $((8#10)) <--- base 8 (octal) value 10 is decimal 8; this will print 8
echo $((2#10)) <--- base 2 (binary) 10 is decimal 2; it will print 2
echo $((16#10)) <--- base 16 (hexadecimal) 10 is decimal 16; it will print 16