Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: multiple background jobs of the same program
- X-seq: zsh-users 1024
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: multiple background jobs of the same program
- Date: Mon, 15 Sep 1997 07:56:33 -0700
- In-reply-to: <5ld8ma95sf.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <9709140326.AA21133@xxxxxxxxxxxxxxxxx> <19970914102839.45957@xxxxxxx> <970914121042.ZM22784@xxxxxxxxxxxxxxxxxxxxxxx> <19970914150505.11879@xxxxxxx> <970914160910.ZM23900@xxxxxxxxxxxxxxxxxxxxxxx> <19970914200202.04363@xxxxxxx> <5len6q9692.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <5ld8ma95sf.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author