From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10435 invoked by alias); 3 Feb 2015 12:47:16 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19794 Received: (qmail 3629 invoked from network); 3 Feb 2015 12:47:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f5-b7fc86d0000066b7-ce-54d0c2bb4707 Date: Tue, 03 Feb 2015 12:47:08 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Hiding command from history Message-id: <20150203124708.443404f0@pwslap01u.europe.root.pri> In-reply-to: References: <20150203121349.53f135fd@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: quoted-printable X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e/4Fd3dhy6EGMw7qGyx4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZTybtY6t4CZXxa0f+5kaGLdxdDFyckgImEj0fZjPDGGLSVy4 t56ti5GLQ0hgKaPEph1/maEcJonVW16yg1SxCKhK9P/8wQJiswkYSkzdNJsRxBYRUJQ48+sb E4gtLKAhcWrlajYQm1fAXuLRlc9A9RwcnALBEg8mSkLMPM8o8WprK1gvv4C+xNW/n5ggrrCX mHnlDCNEr6DEj8n3wHYxC6hLTJq3iBnC1pZ48u4C6wRGgVlIymYhKZuFpGwBI/MqRtHU0uSC 4qT0XCO94sTc4tK8dL3k/NxNjJAg/LqDcekxq0OMAhyMSjy8O7+eDxFiTSwrrsw9xCjBwawk wpu+/EKIEG9KYmVValF+fFFpTmrxIUYmDk6pBsZ5Jfeubee+7X9i4Qx16w3yZvveXg+5/0lm mZ+k8M6Jv4QWbs1O8utepz0x7HfiL873Lc77dA5UXlzMvqmPU6xwz5Ed71dd10zcZdkRdczo d1pSgPlzW8N58yvyX8pv8095lhaQr8twavXh7VbClbXbHMS3ciU63AmuOxz47IVQ9QGf5SWy 3f1KLMUZiYZazEXFiQCJ4RIFIAIAAA== On Tue, 3 Feb 2015 14:34:49 +0200 =C4=B0smail D=C3=B6nmez wrote: > On Tue, Feb 3, 2015 at 2:13 PM, Peter Stephenson > wrote: > > On Tue, 3 Feb 2015 13:29:34 +0200 > > =C4=B0smail D=C3=B6nmez 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=3D" ls" > >> alias mv=3D" 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 >=20 > This seems to be the best option but I can't figure out the syntaxt. > Bash's similar HISTIGNORE syntax >=20 > HISTORY_IGNORE=3D"rm *:ls *" >=20 > doesn't seem to work. Tried with >=20 > > HISTORY_IGNORE=3D"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=3D"(rm|ls) *" You can do this, though: zshaddhistory() { [[ $1 =3D (ls|rm)\ * ]] && return 1; } and indeed there's no reason I can think of why you couldn't simply define zshaddhistory() { [[ $1 =3D ${~HISTORY_IGNORE} ]] && return 1; } pws