zsh-workers
 help / color / mirror / code / Atom feed
From: wischnow@informatik.hu-berlin.de (Sven Wischnowsky)
To: zsh-workers@math.gatech.edu
Subject: Re:  # of commands, not PERIODIC
Date: Thu, 14 Dec 1995 08:34:23 +0100 (MET)	[thread overview]
Message-ID: <199512140734.IAA24642@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Uncle Tim's message of Thu, 14 Dec 1995 01:12:47 -0500 (EST)


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


             reply	other threads:[~1995-12-14  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-14  7:34 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
1995-12-14  6:12 Uncle Tim

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=199512140734.IAA24642@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@math.gatech.edu \
    /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).