Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: multiple background jobs of the same program
- X-seq: zsh-workers 3490
- From: Stefan Monnier <monnier+lists/zsh/workers/news/@TEQUILA.SYSTEMSZ.CS.YALE.EDU>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: multiple background jobs of the same program
- Date: 15 Sep 1997 07:26:40 -0400
- References: <9709140326.AA21133@xxxxxxxxxxxxxxxxx> <19970914102839.45957@xxxxxxx> <970914121042.ZM22784@xxxxxxxxxxxxxxxxxxxxxxx> <19970914150505.11879@xxxxxxx> <970914160910.ZM23900@xxxxxxxxxxxxxxxxxxxxxxx> <19970914200202.04363@xxxxxxx> <5len6q9692.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Sender: monnier@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Stefan Monnier <monnier+lists/zsh/workers/news/@tequila.cs.yale.edu> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author