shopt-option

Bash shopt histappend

Controls appending rather than overwriting the history file when a shell saves history at exit. Does not synchronize concurrent writers. This fixture verifies the setting only; it does not test interactive exit persistence or edit real history. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): append enabled; disabled-status=1.

Formal Syntax & Structure

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

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
unset HISTFILEshopt -s histappendshopt -q histappend || exit 1printf 'append enabled\n'shopt -u histappendshopt -q histappendprintf 'disabled-status=%s\n' "$?"
Bash Reference