Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Joern Knoll Newsgroups: gnu.bash.bug Subject: bug in arithmetic expansion Date: Sat, 9 Nov 2019 11:52:56 +0100 Lines: 33 Approved: bug-bash@gnu.org Message-ID: References: <5415801f-6c6e-9664-7747-9adc02a592f8@gsi.de> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1573308933 24583 209.51.188.17 (9 Nov 2019 14:15:33 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Virus-Scanned: Debian amavisd-new at lxmtout4.gsi.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 140.181.3.147 X-Mailman-Approved-At: Sat, 09 Nov 2019 09:15:32 -0500 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: <5415801f-6c6e-9664-7747-9adc02a592f8@gsi.de> Xref: csiph.com gnu.bash.bug:15581 Hallo, in playing around with digital keys (integers) which have a simple=20 arithmetic check property, I encountered problemsusing bash's arithmetic=20 expansion, when ever the used digital substrings have leading zeros. The=20 problem shows up already for the simplest operations, namely converting=20 a string argument to its numerical value, as shown below. With thanks for your attention and best regards, J=C3=B6rn Knoll [tplx99]:/the/knoll > echo $((0123)) 83 [tplx99]:/the/knoll > echo $((123)) 123 [tplx99]:/the/knoll > echo $((01234)) 668 [tplx99]:/the/knoll > echo $((1234)) 1234 --=20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % J=C3=B6rn Knoll phone: +49 6159 71 2753 % % GSI fax: +49 6159 71 2990 % % Planckstr. 1 email:J.Knoll@gsi.de % % D-64291 Darmstadthttps://theory.gsi.de % % % % GSI Student Programhttps://theory.gsi.de/stud-pro % % Schnelle Ionen e.V.https://www.SchnelleIonen.de % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%