Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: do not write certain commands to history file



Am 25.08.2010 um 21:26 schrieb Eric Smith:

> Oh zsh seers,
> 
> What is the way to match certain words in commands so that they
> are not written to the history file (but might possibly remain in the
> buffer history which does not worry me much)?

What I do is two things: For commands that I never want to see in my history I make an alias for it that begins with a space character, like so:

 alias mkpwlink=' mkpwlink'

If the shell option histignorespace is set, the mkpwlink command will not appear in the history.

If I want to run a whole "session" of commands without history, I use the history stack:

 HISTSTACK=0
 alias histpush="fc -p && ((HISTSTACK += 1))"
 alias histpop="fc -P && ((HISTSTACK -= 1))"

I use the $HISTSTACK variable in my prompt to keep track of my history level.


Sebastian


Messages sorted by: Reverse Date, Date, Thread, Author