From owner-freebsd-stable@FreeBSD.ORG Fri Sep 21 22:26:37 2012 Return-Path: Delivered-To: stable@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 664) id E066C1065673; Fri, 21 Sep 2012 22:26:37 +0000 (UTC) Date: Fri, 21 Sep 2012 22:26:37 +0000 From: David O'Brien To: Jilles Tjoelker Message-ID: <20120921222637.GA58984@hub.freebsd.org> References: <20120921170902.GC28959@albert.catwhisker.org> <20120921173406.GC9070@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120921173406.GC9070@stack.nl> User-Agent: Mutt/1.4.2.1i X-Operating-System: FreeBSD 7.4-STABLE Organization: The NUXI BSD group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 Cc: stable@freebsd.org Subject: Re: /bin/sh arithmetic doesn't seem to like leading 0 now X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@freebsd.org List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Sep 2012 22:26:38 -0000 On Fri, Sep 21, 2012 at 07:34:06PM +0200, Jilles Tjoelker wrote: > On Fri, Sep 21, 2012 at 10:09:02AM -0700, David Wolfskill wrote: > > $ echo $(( ( $( date +%m ) - 1 ) / 3 + 1 )) > > arithmetic expression: expecting ')': " ( 09 - 1 ) / 3 + 1 " ... > This was done to avoid an inconsistency where constants starting with > "0" and containing "8" or "9" were decimal, so something like > $((018-017)) expanded to 3. Jilles, Would it be possible to improve on the error message? If David had been given the Bash error message, I suspect he would have figured out the issue right away. -- -- David (obrien@FreeBSD.org)