Hi,

Alessandro DE LAURENZIS wrote on Fri, Aug 11, 2017 at 01:14:48PM +0200:
> On Fri 11/08/2017 13:07, Janne Johansson wrote:

>> 0<number> is parsed as octal in places, so 09 would be bogus if octal.

> Thanks for the clarification; does that mean expr(1) can treat 10-base 
> numbers only? No info in man page on this matter...

POSIX restricts expr(1) to handle decimal integers only and has some
complicated wording about which strings will be treated as integers
and which won't.  I consider that too cumbersome to explain it in
the manual, in particular since it will rarely matter in practice.

But being specific about the number base adds precision and clarity
without harming readability.

OK?
  Ingo


Index: expr.1
===================================================================
RCS file: /cvs/src/bin/expr/expr.1,v
retrieving revision 1.23
diff -u -p -r1.23 expr.1
--- expr.1      16 Jan 2015 15:30:10 -0000      1.23
+++ expr.1      11 Aug 2017 16:45:29 -0000
@@ -39,16 +39,17 @@ Returns the evaluation of
 if neither expression evaluates to an empty string or zero;
 otherwise, returns zero.
 .It Ar expr1 Li "{=, >, >=, <, <=, !=}" Ar expr2
-Returns the results of integer comparison if both arguments are integers;
-otherwise, returns the results of string comparison using the locale-specific
-collation sequence.
+Returns the results of integer comparison if both arguments are
+decimal integers; otherwise, returns the results of string comparison
+using the locale-specific collation sequence.
 The result of each comparison is 1 if the specified relation is true,
 or 0 if the relation is false.
 .It Ar expr1 Li "{+, -}" Ar expr2
-Returns the results of addition or subtraction of integer-valued arguments.
+Returns the results of addition or subtraction of decimal integer-valued
+arguments.
 .It Ar expr1 Li "{*, /, %}" Ar expr2
 Returns the results of multiplication, integer division, or remainder of
-integer-valued arguments.
+decimal integer-valued arguments.
 .It Ar expr1 Li \&: Ar expr2
 The
 .Ql \&:

Reply via email to