bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $((expr)) allows the hexadecimal constant "0x"


From: Steffen Nurpmeso
Subject: Re: $((expr)) allows the hexadecimal constant "0x"
Date: Thu, 29 Jun 2023 19:17:25 +0200
User-agent: s-nail v14.9.24-489-gc71d14c5bf

Denys Vlasenko wrote in
 <54f87d1b-e700-e1d3-bf70-400c11145e12@redhat.com>:
 |IIRC bash used to allow numeric constants of the
 |BASE#DIGITS form even if the DIGITS part was empty.
 |IOW: not only "64#0", but "64#" too was accepted
 |as a valid zero constant.
 |
 |This no longer works in 5.2.15, probably better than
 |former behavior, "64#" looked quite confusing.
 |
 |However, a somewhat similar situation with hex prefix,
 |0xDIGITS, still allows just "0x" as a valid zero constant.
 |
 |Not sure whether this should be considered a bug,
 |and whether it's worth fixing - just letting you know.

Thanks, now that you say i see i have a similar problem in the
$(()) evaluation of the MUA i maintain.
I now only wondered why you did not also mention the bash bug

  $ echo $((0?2/0:7))
  7
  $ echo $((0?2**-1:7))
  -bash: 0?2**-1:7: exponent less than 0 (error token is ":7")

Ciao1

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]