bug-bash
[Top][All Lists]
Advanced

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

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


From: Robert Elz
Subject: Re: "echo $((0x))" is accepted, treated as 0x0
Date: Sat, 24 Jan 2026 23:13:37 +0700

    Date:        Sat, 24 Jan 2026 09:24:20 +0100
    From:        Andreas =?utf-8?B?S8OkaMOkcmk=?= <andreas.kahari@abc.se>
    Message-ID:  <aXSBtKkWn1bnOmAb@dolores.invalid>

  | 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



reply via email to

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