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


Groups > gnu.bash.bug > #14327 > 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 23:17 -0400
Last post2018-07-10 23:17 -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 23:17 -0400

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

FromChet Ramey <chet.ramey@case.edu>
Date2018-07-10 23:17 -0400
SubjectRe: Number with sign is read as octal despite a leading 10#
Message-ID<mailman.3415.1531279108.1292.bug-bash@gnu.org>
On 7/10/18 4:57 PM, Isaac Marcos wrote:
> Chet Ramey (<chet.ramey@case.edu <mailto:chet.ramey@case.edu>>) wrote:
> 
>     On 7/10/18 2:48 PM, Isaac Marcos wrote:
>     >     That is not an integer constant. Integer constants don't begin
>     with `-'.
> 
> 
> That makes negative numbers invalid.

You need to look at the difference between constants and operators. This is
what allows you to write $(( -a )), for instance.

>     Because of the difference between an operator and a constant. Unary plus
>     and minus have a higher precedence than arithmetic operators. So if you
>     expand the `a' to an expression, which is what happens, the expression
>     consists of an operator (+ or -) and a constant, and that expression has
>     a higher precedence than the +. You might think about why using `$a' in
>     place of the `a' would not work all the time.
> 
> 
> 
> I don't care. All other shells do this correctly. It makes you the only one
> wrong.

"All other shells" is kind of a broad statement.

-- 
``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