shopt-option

histreedit shell option

When Readline is active, makes a failed history substitution available for editing rather than merely discarding it. This is distinct from histverify, which handles successful substitutions. The example verifies state only. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): enabled then disabled.

Formal Syntax & Structure

bash syntaxbash
shopt -s histreedit; shopt -u histreedit

Return Value

exit status

Returns zero on success and nonzero on failure; option queries return zero when enabled.

Working Example

Example Snippetbash
shopt -s histreedit || exit 1shopt -q histreedit || exit 1shopt -u histreedit || exit 1if shopt -q histreedit; then exit 1; fiprintf "enabled then disabled\n"
Bash Reference