Dobromir Romankiewicz wrote:
> And run this code:
> :2() { x1=0; x2=0; x3=0; x4=8
> echo $[$x1$x2$x3$x4]
> }
> It crashes with message:
> bash: 0008: value too great for base (error token is "0008").

Thank you for the report.  But you have run into Bash FAQ E8.

Numbers with leading zeros are read as octal constants.  Octal is
composed of '0' through '7'.  The number '8' is too large to be an
octal number.

  $ echo $((0008))
  bash: 0008: value too great for base (error token is "0008")

To have the number read as a decimal number the leading zeros must be
removed.

  $ echo $((8))
  8

Note also that the use of $[expression] for $((expression)) is
documented as deprecated and to be removed in a future version.
Better to use $((expression)) instead.

Bob


Reply via email to