Skip to main content

bash_printf_empty_numeric_error

Function bash_printf_empty_numeric_error 

Source
pub fn bash_printf_empty_numeric_error(arg: Option<&String>) -> bool
Expand description

True when printf in bash mode should treat this operand to a numeric conversion (%d %i %o %u %x %X) as an error (still prints 0, but exit status 1). bash — unlike zsh/ksh/dash/sh — errors on an explicitly-supplied EMPTY operand (printf '%d' '' → rc 1); a MISSING operand (printf '%d') is NOT an error, so arg distinguishes them: Some("") → true, None → false. Non-empty junk (“abc”/“+”/“ “) already errors via mathevali in every mode, so only the empty-string case is handled here. Verified vs bash 5.x.