Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!usenet.stanford.edu!not-for-mail From: Greg Wooledge Newsgroups: gnu.bash.bug Subject: Re: Inconsistent arithmetic evaluation of parameters Date: Tue, 1 Sep 2015 16:23:08 -0400 Lines: 27 Approved: bug-bash@gnu.org Message-ID: References: <61895190-83A6-4D62-B90E-65023D5E966B@gmail.com> <20150901175030.GP4309@eeg.ccf.org> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1441138996 28360 208.118.235.17 (1 Sep 2015 20:23:16 GMT) X-Complaints-To: action@cs.stanford.edu Cc: "bug-bash@gnu.org" To: Dennis Williamson Envelope-to: bug-bash@gnu.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 139.137.100.1 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11453 On Tue, Sep 01, 2015 at 03:13:57PM -0500, Dennis Williamson wrote: > The version of dash I have handy (0.5.7) has math support which IMHO is > broken: > > $ foo=bar > $ bar=5 > $ echo $foo > bar > $ echo $((foo)) > dash: 4: Illegal number: bar > $ echo $(($foo)) > 5 > $ echo $((bar)) > 5 > $ echo $(($bar)) > 5 > > Note the inconsistency in support of omitting the inner dollar sign. $foo is expanded to bar, so the following two lines are always going to be equivalent: echo $(($foo)) echo $((bar)) POSIX also specifies (vaguely!!) that $((x)) and $(($x)) are equivalent.