From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with ESMTP id SAA13473 for ; Thu, 14 Dec 1995 18:56:22 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id CAA10350; Thu, 14 Dec 1995 02:34:18 -0500 (EST) Resent-Date: Thu, 14 Dec 1995 02:34:18 -0500 (EST) Date: Thu, 14 Dec 1995 08:34:23 +0100 (MET) From: wischnow@informatik.hu-berlin.de (Sven Wischnowsky) Message-Id: <199512140734.IAA24642@beta.informatik.hu-berlin.de> To: zsh-workers@math.gatech.edu In-reply-to: Uncle Tim's message of Thu, 14 Dec 1995 01:12:47 -0500 (EST) Subject: Re: # of commands, not PERIODIC Resent-Message-ID: <"YyNGI2.0.bX2.vDzpm"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/692 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Uncle Tim wrote: > > > > I know of the periodic command, which works based on a set-time. > I'd like some command which will be run based on the number of > commands which are entered into the history list. I'd like to have > something run every 10 lines or so... > You can do that with precmd: precmd() { local h=$[ $(print -P '%h') % 10 ] if [[ $h -eq 0 ]] then ... fi } Interestingly neither `if [[ $(print -P '%h') % 10 -eq 0 ]]', nor `h=$(print -P '%h'); if [[ $h % 10 -eq 0]]' works, both give a parse error. Oops, I just found, that: precmd() { [ ( $(print -P '%h') % 10 ) -eq 0 ] && ... } works (with the `[...]' thing, but not with `[[...]]'). Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de