These two questions address how to keep a given command from being added to the shell history:
- Is there any way to keep a command from being added to your history?
- How can I run a command in zsh without pushing it onto the current session's history?
The answers focus on solutions where the user prefixes each command (e.g. with a space). What I am looking for is a single command that I can run once, and that would effectively "freeze" my history file in the shell until I unfreeze it later with another command.
While the history is "frozen":
I want my commands to be able to be able to read from the existing history file (e.g. so that I can do command searches e.g.
C-r
, and standard autocompletion.I want to prevent any commands I run from being added to the history
How can I accomplish this with zsh?
HISTORY_IGNORE
to something like*
be in the right direction?