Subject: Re: Arithmetic, octal and leading zeroes in sh
To: Stephen Borrill <firstname.lastname@example.org>
From: Todd Vierling <email@example.com>
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 18.104.22.168 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 <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>