Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14319 > unrolled thread

Re: Number with sign is read as octal despite a leading 10#

Started byChet Ramey <chet.ramey@case.edu>
First post2018-07-10 11:11 -0400
Last post2018-07-10 11:11 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Number with sign is read as octal despite a leading 10# Chet Ramey <chet.ramey@case.edu> - 2018-07-10 11:11 -0400

#14319 — Re: Number with sign is read as octal despite a leading 10#

FromChet Ramey <chet.ramey@case.edu>
Date2018-07-10 11:11 -0400
SubjectRe: Number with sign is read as octal despite a leading 10#
Message-ID<mailman.3383.1531235477.1292.bug-bash@gnu.org>
On 7/10/18 11:04 AM, Greg Wooledge wrote:
> On Tue, Jul 10, 2018 at 11:00:36AM -0400, Chet Ramey wrote:
>> On 7/9/18 9:24 PM, Isaac Marcos wrote:
>>
>>> Bash Version: 4.4
>>> Patch Level: 12
>>> Release Status: release
>>>
>>> Description:
>>> A value inside an arithmetic expansion is processed as octal despite using
>>> a 10# preffix.
>>
>> An integer constant cannot contain a `+'.
>>
>>>
>>> Repeat-By:
>>>         $ echo $((10#+0034))
>>>         28
>>
>> If anything, this is bash being too liberal in accepting constants that
>> begin with `base#'. There would be a good case for rejecting the `10#'
>> because it's missing the value.
> 
> It also happens with negative values.  I wish the original poster had
> shown that case as well.

It doesn't matter. Unary plus and minus are operators, not part of integer
constants.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web