When I use bash shell I can easily pause history by using
set +o history
and turn it back on by using
set -o history
but this doesn’t work in z shell why? How can I make it work?
When I use bash shell I can easily pause history by using
set +o history
and turn it back on by using
set -o history
but this doesn’t work in z shell why? How can I make it work?
Hi @Char,
I’m guessing you want to pause the session’s history recording, which according to this page:
With
setopt histignorespace
, the command is removed from the current session history. If you tested by pressing Up and seeing that the command line is still there, it’s a feature.
Note that the command lingers in the internal history until the next command is entered before it vanishes, allowing you to briefly reuse or edit the line. If you want to make it vanish right away without entering another command, type a space and press return.
If you typed a command that didn’t start with a space or didn’t have the
histignorespace
option turned on, then there’s no way to remove the command from the current session’s history (you can edit the history file externally).
I don’t know if this helps, but I hope it does!
Edit:
Also see:
Thank you
You can also toggle back-and-forth with:
unset HISTFILE
and
set HISTFILE
HISTFILE=~/.zhistory
EDIT: Fixed correction noted by @Mirdarthos below.
Replace ~/.zhistory
with the actual file if it differs on your system.
Just tried this,
And although this
unset HISTFILE
seem to have worked, this:
set HISTFILE
had absolutely no effect. So, I had to run:
fc -p ~/.zhistory
to restore it. Will see if it persists after a reboot.
Edit:
Just rebooted and it persisted.
Good catch, and I fixed my above post based on your trials.
So technically, you can toggle back-and-forth like this:
unset HISTFILE
and
HISTFILE=~/.zhistory
Replace ~/.zhistory
with the actual file if it differs on your system.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.