From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 618 invoked from network); 15 Sep 1997 11:31:36 -0000 Received: from math.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 15 Sep 1997 11:31:36 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id HAA17194; Mon, 15 Sep 1997 07:26:21 -0400 (EDT) Resent-Date: Mon, 15 Sep 1997 07:26:21 -0400 (EDT) To: zsh-workers@math.gatech.edu Sender: monnier@TEQUILA.SYSTEMSZ.CS.YALE.EDU From: Stefan Monnier Newsgroups: lists.zsh.workers Subject: Re: multiple background jobs of the same program References: <9709140326.AA21133@cryptica.UCSD.EDU> <19970914102839.45957@sco.com> <970914121042.ZM22784@candle.brasslantern.com> <19970914150505.11879@sco.com> <970914160910.ZM23900@candle.brasslantern.com> <19970914200202.04363@sco.com> <5len6q9692.fsf@tequila.systemsz.cs.yale.edu> Date: 15 Sep 1997 07:26:40 -0400 Message-ID: <5ld8ma95sf.fsf@tequila.systemsz.cs.yale.edu> X-Newsreader: Gnus v5.5/Emacs 20.0 Path: tequila.systemsz.cs.yale.edu NNTP-Posting-Host: tequila.systemsz.cs.yale.edu Resent-Message-ID: <"Mjq4_2.0.bC4.SjH7q"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3490 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Stefan Monnier writes: > Good point, here is a version that should correctly ignore the "(tty input)" > thingie if present: I must be stupid, because a much simpler alternative works just as well if not better: complete_listjobs() { tmpfile=$TMP/zshjobcomp.$$ jobs >| $tmpfile 2>&1 if [[ -s $tmpfile ]] then reply=( "${(@f)$(sed -e '{ s/^\[\([0-9]*\)\][-+ ]*/%\1 ;: / }' $tmpfile)}" ) else reply=() fi } compctl -Q -K complete_listjobs fg bg kill -- Stefan PS: a few improvements possible: - only list the plainly suspended jobs (and not waiting on tty) for bg - aknowledge the fact that kill has more uses than to kill jobs. the jobs completion should only work once "%" is entered. "ls /proc" might be used as well as "kill -l" for other cases.