Are integers in Bash signed by default?

Viewed 47

I suspect that, by default, integers in Bash are always signed unless they exceed a specific positive value that cannot be represented in two's complement notation. Is that so? Is it documented?

I have done much research but have not found confirmation of this.

1 Answers

According to the changelog, since Bash 2.05b,

j. The shell now performs arithmetic in the largest integer size the machine supports (intmax_t), instead of long.

intmax_t is indeed a signed type.

Related