/bin/sh arithmetic doesn't seem to like leading 0 now

David Wolfskill david at catwhisker.org
Fri Sep 21 17:23:37 UTC 2012


On Fri, Sep 21, 2012 at 01:20:07PM -0400, Brandon Allbery wrote:
> On Fri, Sep 21, 2012 at 1:09 PM, David Wolfskill <david at catwhisker.org>wrote:
> 
> > $ echo $(( 09 + 0 ))
> >
> 
> Unable to get to fbsd box now but suspicious mind wants to know what
> happens with 07 in place of 09.

As (I) expected, it's handled Just fine:

$ uname -r
9.1-PRERELEASE
$ echo $(( 07 + 0 ))
7
$ 

So yeah, this seems to be something involving treating leading 0 as
indicating octal (and seriously disliking "9" in such a context).

Peace,
david
-- 
David H. Wolfskill				david at catwhisker.org
Depriving a girl or boy of an opportunity for education is evil.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20120921/fdf7966f/attachment.pgp


More information about the freebsd-stable mailing list