shopt-option

Bash shopt gnu_errfmt

Changes Bash diagnostic formatting toward the GNU convention; it does not alter command success or failure. Exact messages vary with version and locale. Fixture verifies a failing redirection while the option is active, not a stable diagnostic string. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): failure recorded.

Formal Syntax & Structure

bash syntaxbash
shopt -s gnu_errfmt; shopt -u gnu_errfmt; shopt -q gnu_errfmt

Return Value

exit status

Option-setting command returns zero for a valid request; query status is zero if enabled, one if disabled.

Working Example

Example Snippetbash
shopt -s gnu_errfmtmkdir folder{ : > folder; } 2> diagnosticrc=$?[[ $rc != 0 && -s diagnostic ]] || exit 1printf 'failure recorded\n'
Bash Reference