On Sat, 24 Jan 2026 at 12:10, Denys Vlasenko <dvlasenk@redhat.com> wrote:
Subject: "echo $((0x))" is accepted, treated as 0x0
The subject says it all.
Working as intended and as documented.
Intended, yes, as a longtime extension. Documented as such, not so much.
This is so that "echo $((0x$foo))" works as intended when foo contains only
hexadecimal digits. Note that the empty string complies with that
requirement.
This is not a particularly strong argument. If there's a concern that $foo
might be empty, there are easy workarounds.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/