From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27587 invoked from network); 11 Dec 2005 19:58:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) 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.0 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Dec 2005 19:58:59 -0000 Received: (qmail 82254 invoked from network); 11 Dec 2005 19:58:52 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Dec 2005 19:58:52 -0000 Received: (qmail 24409 invoked by alias); 11 Dec 2005 19:58:45 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9776 Received: (qmail 24400 invoked from network); 11 Dec 2005 19:58:45 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 11 Dec 2005 19:58:45 -0000 Received: (qmail 81294 invoked from network); 11 Dec 2005 19:58:45 -0000 Received: from vms042pub.verizon.net (206.46.252.42) by a.mx.sunsite.dk with SMTP; 11 Dec 2005 19:58:43 -0000 Received: from candle.brasslantern.com ([71.116.81.225]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRC00GYZNHT4ZOF@vms042.mailsrvcs.net> for zsh-users@sunsite.dk; Sun, 11 Dec 2005 13:58:42 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id jBBJwevq020463 for ; Sun, 11 Dec 2005 11:58:40 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id jBBJwept020462 for zsh-users@sunsite.dk; Sun, 11 Dec 2005 11:58:40 -0800 Date: Sun, 11 Dec 2005 19:58:39 +0000 From: Bart Schaefer Subject: Re: job control from script In-reply-to: <20051211172135.0f1caefc.rgo@mail.interzet.ru> To: zsh-users@sunsite.dk Message-id: <1051211195839.ZM20461@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20051211172135.0f1caefc.rgo@mail.interzet.ru> Comments: In reply to rgo "job control from script" (Dec 11, 5:21pm) On Dec 11, 5:21pm, rgo wrote: } } Why `kill %' doesn't work? What do you expect it to do, and why? There's no job specifier that means "all jobs". I've tried both bash and ksh and "kill %" in those shells kills exactly one job (the most recent one, as if "kill %+"). Zsh is the same. } And `kill %NUM'? And how can I fetch job list for use in script? You can either zmodload zsh/parameter kill %${(k)^jobstates} or (if your version of zsh is recent enough that piping the jobs command produces useful output) use jobs -p | while read jnum jpid text; do kill $jpid; done The easiest thing, though, might be setopt MONITOR HUP function TRAPINT() { kill -HUP $$ } which just says that on an INTerrupt, send a HUP signal, which will then automatically be propagated to all the child processes.