Re: "echo $((0x))" is accepted, treated as 0x0
Andreas Kähäri <[email protected]>
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jan 24, 2026 at 11:13:37PM +0700, Robert Elz wrote: > 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 Well, it's at least consistent with $ declare -i v= $ echo $v 0 -- Matti Andreas Kähäri Uppsala, Sweden .