variable

HISTIGNORE

A colon-separated list of patterns matched against complete command lines after HISTCONTROL checks. The patterns are shell patterns, not regular expressions. This fixture omits matching synthetic commands from history; the omitted commands still execute. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): executed but not saved.

Formal Syntax & Structure

bash syntaxbash
HISTIGNORE

Return Value

shell variable

Expansion yields the current value; it has no independent command exit status.

Working Example

Example Snippetbash
bash --noprofile --norc -s > output <<'SCRIPT'set -o historyHISTIGNORE='echo omit*'echo omittedecho kepthistory -w synthetic.historySCRIPTgrep -Fxq omitted output || exit 1grep -Fxq 'echo kept' synthetic.history || exit 1if grep -Fxq 'echo omitted' synthetic.history; then exit 1; fiprintf 'executed but not saved\n'
Bash Reference