Subject: Re: Arithmetic, octal and leading zeroes in sh
To: Stephen Borrill <email@example.com>
From: Todd Vierling <firstname.lastname@example.org>
Date: 10/13/2005 08:35:52
On Thu, 13 Oct 2005, Stephen Borrill wrote:
> I see from the 1.11 commit this is to recognise octal and hex, but must a
> leading zero always indicate octal?
Yes; that's standard practice in Unix (and the C programming language). It
is also required by the Open Group shell specification:
Only the decimal-constant, octal-constant, and hexadecimal-constant
constants specified in the ISO C standard, Section 126.96.36.199 are required to
be recognized as constants.
"octal-constant" is specified as an all-digits number prefixed by "0".
("hexadecimal-constant" is specified as a hexadecimal number prefixed by
"0x" or "0X".)
So actually, NetBSD 1.6.x's shell is the broken one. 8-)
-- Todd Vierling <email@example.com> <firstname.lastname@example.org> <email@example.com>