From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2592 invoked from network); 12 Oct 2006 05:09:29 -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=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 05:09:29 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 11421 invoked from network); 12 Oct 2006 05:09:22 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Oct 2006 05:09:22 -0000 Received: (qmail 2817 invoked by alias); 12 Oct 2006 05:09:14 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10834 Received: (qmail 2808 invoked from network); 12 Oct 2006 05:09:13 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 12 Oct 2006 05:09:13 -0000 Received: (qmail 10159 invoked from network); 12 Oct 2006 05:09:13 -0000 Received: from parhelion.firedrake.org (193.201.200.77) by a.mx.sunsite.dk with SMTP; 12 Oct 2006 05:09:12 -0000 Received: from phil by parhelion.firedrake.org with local (Exim 4.50 #1 (Debian)) id 1GXsoh-0002Gw-3f; Thu, 12 Oct 2006 06:09:11 +0100 Date: Thu, 12 Oct 2006 07:09:11 +0200 From: Phil Pennock To: Meino Christian Cramer Cc: zsh-users@sunsite.dk Subject: Re: Makeing history harmless Message-ID: <20061012050911.GA4764@parhelion.globnix.org> Mail-Followup-To: Meino Christian Cramer , zsh-users@sunsite.dk References: <20061012.044715.74744338.Meino.Cramer@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061012.044715.74744338.Meino.Cramer@gmx.de> Sender: Phil Pennock 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. (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 >------------------------------- Regards, -Phil