[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Number with sign is read as octal despite a leading 10#
From: |
Chet Ramey |
Subject: |
Re: Number with sign is read as octal despite a leading 10# |
Date: |
Tue, 10 Jul 2018 11:11:14 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 |
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/
- Re: Number with sign is read as octal despite a leading 10#, (continued)
- Message not available
- Message not available
- Re: Number with sign is read as octal despite a leading 10#, Isaac Marcos, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Eduardo Bustamante, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Isaac Marcos, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Isaac Marcos, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Robert Elz, 2018/07/13
- Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10
- Re: Number with sign is read as octal despite a leading 10#, Pierre Gaston, 2018/07/10
Re: Number with sign is read as octal despite a leading 10#, Chet Ramey, 2018/07/10