address@hidden (Bob Proulx) writes:
> integer
>
> An argument consisting only of an (optional) unary minus followed by
> digits.
It also says, for example:
expr1 + expr2 Addition of decimal integer-valued arguments.
So, under your interpretation, "expr 010" would print 8, but "expr 010
+ 0" would print 10? That doesn't sound right to me.
> Neither that nor the info documentation says anything about a base for
> the integer constants. Since it is not specified why couldn't it use
> the C rules the same as printf does?
Even if you're right that POSIX allows "expr 08" to fail (which I
doubt), GNU expr would still disagree with all the other
implementations out there. I don't think the incompatibility hassles
would be worth it.
There are lots of places where POSIX is inconsistent: sometimes it
requires that 010 be treated as 8, sometimes not. It's a mess, but
fixing it would require changing POSIX, not an easy task and one that
I'm not sure is worth it. Plus, how many old scripts would you break?