zsh-workers
 help / color / mirror / code / Atom feed
* Re:  # of commands, not PERIODIC
@ 1995-12-14  7:34 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1995-12-14  7:34 UTC (permalink / raw)
  To: zsh-workers


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* # of commands, not PERIODIC
@ 1995-12-14  6:12 Uncle Tim
  0 siblings, 0 replies; 2+ messages in thread
From: Uncle Tim @ 1995-12-14  6:12 UTC (permalink / raw)
  To: ZSH Users List



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...

thanks
TjL
--
Timothy J. Luoma                        luomat@capitalist.princeton.edu 
At 6:06pm EST on Dec 11, 1995 Nicholas Anthony Aiello (son of my sister 
and brother-in-law) entered the world 8 pounds, 13oz, making me an uncle 
for the first time. 8^)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-12-14  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-12-14  7:34 # of commands, not PERIODIC Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1995-12-14  6:12 Uncle Tim

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).