Re: "echo $((0x))" is accepted, treated as 0x0

Chet Ramey <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 1/24/26 8:23 AM, Denys Vlasenko wrote:

> But why it's different for
> 
> $ digits=''; echo $((16#$digits))
> bash: 16#: invalid integer constant (error token is "16#")

I changed it back in 2020. Here's the original report.

https://lists.gnu.org/archive/html/bug-bash/2019-06/msg00039.html

There were some notable objections:

https://lists.gnu.org/archive/html/bug-bash/2022-07/msg00072.html

and the expected rebuttals:

https://lists.gnu.org/archive/html/bug-bash/2022-07/msg00073.html

I was convinced to keep the 0x extension for backwards compatibility.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCaXeveAUDAAAAAAAKCRC7WGnwZOp0q/gk
AJ9vBI2nDZaEIYGcQPLQpAb4ayb5mACeL09kRzgRmZH7BuWOFcEvi4ZvC58=
=lruD
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.