From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1917 invoked from network); 15 Sep 1997 15:04:20 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 15 Sep 1997 15:04:20 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id KAA20248; Mon, 15 Sep 1997 10:57:05 -0400 (EDT) Resent-Date: Mon, 15 Sep 1997 10:56:34 -0400 (EDT) From: "Bart Schaefer" Message-Id: <970915075634.ZM30556@candle.brasslantern.com> Date: Mon, 15 Sep 1997 07:56:33 -0700 In-Reply-To: <5ld8ma95sf.fsf@tequila.systemsz.cs.yale.edu> Comments: In reply to Stefan Monnier "Re: multiple background jobs of the same program" (Sep 15, 7:26am) 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> <5ld8ma95sf.fsf@tequila.systemsz.cs.yale.edu> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-users@math.gatech.edu Subject: Re: multiple background jobs of the same program MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"M9anc3.0.or4.XoK7q"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1024 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sep 15, 7:26am, Stefan Monnier wrote: > Subject: Re: multiple background jobs of the same program > > I must be stupid, because a much simpler alternative works just as well if not > better: What's $TMP ? When I first cut'n'pasted this, I got zsh: permission denied: /zshjobcomp.30447 Here's a better idea: complete_listjobs() { tmpfile=${TMPPREFIX}jobcomp.$$ jobs >&| $tmpfile if [[ -s $tmpfile ]] then reply=("${(@f)$(sed -e 's/^\[\([0-9]*\)\][-+ ]*/%\1 ;: /' $tmpfile)}") else reply=() fi } compctl -Q -K complete_listjobs fg bg kill If not for the nofunctionargzero option, I'd use $TMPPREFIX$0.$$ for the temp file name. > - 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. Too bad both of those would require separate but very similar functions. Or is there some way to get at the name of the command that caused the completion to be selected? (Also too bad that using /proc isn't portable. `ps` output is better, but only marginally.) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com