Subject: Re: Arithmetic, octal and leading zeroes in sh
To: Stephen Borrill <netbsd@precedence.co.uk>
From: Todd Vierling <tv@duh.org>
List: netbsd-users
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:
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_04
[...]
Only the decimal-constant, octal-constant, and hexadecimal-constant
constants specified in the ISO C standard, Section 6.4.4.1 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 <tv@duh.org> <tv@pobox.com> <todd@vierling.name>