On 2024-11-20 07:31, Martin D Kealey wrote:
 From a semantic perspective, because "" doesn't contain any non-digits.

Under that argument, "printf %d -" shouldn't report an error either, because "-" doesn't contain anything other than what could appear in an integer.

Anyway, this isn't an issue of personal preference, as POSIX says printf must diagnose anything that isn't a valid C integer constant, and the empty string is clearly not such a constant. If Bash is in POSIX mode it must issue a diagnostic, and there's little reason for Bash's non-POSIX mode to differ.

Reply via email to