Re: "printf %d ''" should diagnose the empty string
From:
Robert Elz
Subject:
Re: "printf %d ''" should diagnose the empty string
Date:
Sat, 08 Feb 2025 16:29:56 +0700
Date: Sat, 8 Feb 2025 10:09:30 +0100
From: Phi Debian <phi.debian@gmail.com>
Message-ID:
<CAJOr74iubBoLbjH_tkiYzRdQxnzZpH9JDC+WgCh5ztQQzZph8Q@mail.gmail.com>
| Why 2#1 is invalid ?
It isn't a valid form for a C constant. bash allows that kind of thing
in its arithmetic contexts, but this is not one.
You did notice that printf printed '2' not the bash arith value, which
would be 1, right? That's a reason for seeing the warning messages,
when the format is incorrect, the value produced isn't always what you'd
hope it might be.
kre