From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14476 invoked from network); 12 Oct 2006 13:15:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.6 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 12 Oct 2006 13:15:50 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 28862 invoked from network); 12 Oct 2006 13:15:45 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Oct 2006 13:15:45 -0000 Received: (qmail 7203 invoked by alias); 12 Oct 2006 13:15:34 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10847 Received: (qmail 7090 invoked from network); 12 Oct 2006 13:15:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Oct 2006 13:15:32 -0000 Received: (qmail 27274 invoked from network); 12 Oct 2006 13:15:32 -0000 Received: from bes.cs.utk.edu (160.36.56.220) by a.mx.sunsite.dk with SMTP; 12 Oct 2006 13:15:28 -0000 Received: from localhost (localhost [127.0.0.1]) by bes.cs.utk.edu (Postfix) with ESMTP id DB434FD05 for ; Thu, 12 Oct 2006 09:15:05 -0400 (EDT) X-Virus-Scanned: by amavisd-new with ClamAV and SpamAssasin at cs.utk.edu Received: from bes.cs.utk.edu ([127.0.0.1]) by localhost (bes.cs.utk.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id syi6N2EJKesp for ; Thu, 12 Oct 2006 09:15:00 -0400 (EDT) Received: from namib.cs.utk.edu (namib.cs.utk.edu [160.36.59.92]) by bes.cs.utk.edu (Postfix) with ESMTP id E4914FCFF for ; Thu, 12 Oct 2006 09:15:00 -0400 (EDT) Received: by namib.cs.utk.edu (Postfix, from userid 10605) id 3709436CCD; Thu, 12 Oct 2006 09:15:21 -0400 (EDT) Date: Thu, 12 Oct 2006 09:15:21 -0400 From: Chris Johnson To: zsh-users@sunsite.dk Subject: Re: Makeing history harmless Message-ID: <20061012131521.GA8265@namib.cs.utk.edu> References: <20061012.044715.74744338.Meino.Cramer@gmx.de> <20061012050911.GA4764@parhelion.globnix.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061012050911.GA4764@parhelion.globnix.org> User-Agent: Mutt/1.5.9i Phil Pennock sent me the following 0.9K: > On 2006-10-12 at 04:47 +0200, Meino Christian Cramer wrote: > > Is it possible to write a "something" to filter out certain commands > > or to modify certain commands before they were copied from the > > commandline into the history ? > > (1) setopt hist_ignore_space > Then get used to typing a space at the start of the line of > dangerous commands. The item remains in the history only until the > next command is run. It took me a bit to catch on to the fact that the most recently executed line is always in the history. > (2) Combine that option with a new accept-line to apply it automatically > > -----------------------------< cut here >------------------------------- > setopt hist_ignore_space > > function histfilter-accept-line { > emulate -L zsh > case ${${(z)BUFFER}[1]} in > (rm|rmdir) BUFFER=" $BUFFER" ;; > esac > zle .accept-line > } > > zle -N histfilter-accept-line > zle -A histfilter-accept-line accept-line > -----------------------------< cut here >------------------------------- I do this with: setopt hist_ignore_space alias rm=' rm' Is there an advantage to using the widget? -- Chris Johnson cjohnson@cs.utk.edu http://www.cs.utk.edu/~cjohnson