shopt-option

Bash shopt cmdhist

Controls whether multiline commands are saved together in history, using separators when needed. Its effect concerns interactive history collection. The fixture only verifies the option toggles; use a disposable interactive shell to inspect multiline history. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): enabled; disabled-status=1.

Formal Syntax & Structure

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

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 cmdhistshopt -q cmdhist || exit 1printf 'enabled\n'shopt -u cmdhistshopt -q cmdhistprintf 'disabled-status=%s\n' "$?"
Bash Reference