zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Stark <seb@biskalar.de>
To: Eric Smith <es@fruitcom.com>
Cc: zsh-users@zsh.org
Subject: Re: do not write certain commands to history file
Date: Thu, 26 Aug 2010 10:10:35 +0200	[thread overview]
Message-ID: <D2391612-21FA-43FB-B0D7-E7D150A9F718@biskalar.de> (raw)
In-Reply-To: <20100825192608.GG11622@trustfood.org>


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

  parent reply	other threads:[~2010-08-26  8:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25 19:26 Eric Smith
2010-08-25 19:46 ` Mikael Magnusson
2010-08-25 20:36   ` Eric Smith
2010-08-25 20:41     ` Mikael Magnusson
2010-08-25 20:55     ` Benjamin R. Haskell
2010-08-25 21:01       ` Mikael Magnusson
2010-08-25 21:11         ` Benjamin R. Haskell
2010-08-25 21:01       ` do not write certain commands to history file - solved Eric Smith
2010-08-26  8:10 ` Sebastian Stark [this message]
2010-08-26  8:28 ` do not write certain commands to history file Sebastian Stark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D2391612-21FA-43FB-B0D7-E7D150A9F718@biskalar.de \
    --to=seb@biskalar.de \
    --cc=es@fruitcom.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).