Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Robert Elz Newsgroups: gnu.bash.bug Subject: Re: bug in arithmetic expansion Date: Sun, 10 Nov 2019 00:14:10 +0700 Lines: 19 Approved: bug-bash@gnu.org Message-ID: References: <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com> <5415801f-6c6e-9664-7747-9adc02a592f8@gsi.de> <27430.1573319650@jinx.noi.kre.to> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: usenet.stanford.edu 1573319701 30157 209.51.188.17 (9 Nov 2019 17:15:01 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: Davide Brini Envelope-to: bug-bash@gnu.org In-Reply-To: <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 202.29.151.3 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <27430.1573319650@jinx.noi.kre.to> X-Mailman-Original-References: <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com> <5415801f-6c6e-9664-7747-9adc02a592f8@gsi.de> Xref: csiph.com gnu.bash.bug:15588 Date: Sat, 9 Nov 2019 16:39:52 +0100 From: Davide Brini Message-ID: <1MI5UD-1ifIp305PL-00FFhG@mail.gmx.com> | If you want to force base 10 interpretation (remember that leading 0 mean | octal in arithmetic context), you need to explicitly tell bash: | | $ echo $(( 10#0123 )) | 123 But do remember that that form is not portable, and is difficult to use correctly in the cases that matter (when the actyal number comes from a variable .. when it is literal, as in all the examples in this thread, simply omitting the leading 0 is much simpler, and fully portable). kre