From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Hiding command from history
Date: Tue, 03 Feb 2015 12:47:08 +0000 [thread overview]
Message-ID: <20150203124708.443404f0@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAJ1KOAiEt6KA1zN8e16_ZUdX-SdMmNuaMBTRsq+yj3hsXWJrkg@mail.gmail.com>
On Tue, 3 Feb 2015 14:34:49 +0200
İsmail Dönmez <ismail@donmez.ws> wrote:
> On Tue, Feb 3, 2015 at 2:13 PM, Peter Stephenson
> <p.stephenson@samsung.com> wrote:
> > On Tue, 3 Feb 2015 13:29:34 +0200
> > İsmail Dönmez <ismail@donmez.ws> wrote:
> >> I know I can set HIST_IGNORE_SPACE and any command starting with space
> >> will not be logged in history. But with that I have many aliases like
> >>
> >> alias ls=" ls"
> >> alias mv=" mv"
> >>
> >> etc. So, I wonder if there is an easier way to blacklist multiple
> >> commands from history without creating an alias for each of them?
> >
> > Have a look at HISTORY_IGNORE in the zshparam manule
>
> This seems to be the best option but I can't figure out the syntaxt.
> Bash's similar HISTIGNORE syntax
>
> HISTORY_IGNORE="rm *:ls *"
>
> doesn't seem to work. Tried with
>
> > HISTORY_IGNORE="rm *:ls *" zsh
HISTORY_IGNORE just stops things being written to history files;
I don't think that's quite you want. If it was, it's a single pattern,
so you should be able to do
HISTORY_IGNORE="(rm|ls) *"
You can do this, though:
zshaddhistory() { [[ $1 = (ls|rm)\ * ]] && return 1; }
and indeed there's no reason I can think of why you couldn't simply
define
zshaddhistory() { [[ $1 = ${~HISTORY_IGNORE} ]] && return 1; }
pws
next prev parent reply other threads:[~2015-02-03 12:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 11:29 İsmail Dönmez
2015-02-03 12:13 ` Peter Stephenson
2015-02-03 12:34 ` İsmail Dönmez
2015-02-03 12:47 ` Peter Stephenson [this message]
2015-02-03 13:06 ` İsmail Dönmez
2015-02-03 13:49 ` İsmail Dönmez
2015-02-03 14:02 ` Peter Stephenson
2015-02-03 14:07 ` İsmail Dönmez
2015-02-03 16:39 ` Peter Stephenson
2015-02-03 12:37 ` Peter Stephenson
2015-02-04 17:35 ` Bart Schaefer
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=20150203124708.443404f0@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.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).