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

Robert Elz <[email protected]>
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
    Date:        Sat, 24 Jan 2026 09:24:20 +0100
    From:        Andreas =?utf-8?B?S8OkaMOkcmk=?= <[email protected]>
    Message-ID:  <[email protected]>

  | On Sat, Jan 24, 2026 at 03:10:28AM +0100, Denys Vlasenko wrote:
  | > The subject says it all.

  | And $(()) is expanded to 0.  What would you suggest would happen?

At least in posix mode, both should be rejected as errors.   Since they
are errors, neither 0x nor "" (I mean nothing) is a valid C expression,
it is not necessarily invalid for a shell to allow them as extensions.
But they are extensions, and in posix mode really should be rejected,
so application writers can better test their scripts for better portabillity.

kre
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.