Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: get the number of active jobs to show in the prompt?



On Mon, Oct 01, 2001 at 08:37:58AM +0200, Phil Pennock wrote:
> The key thing is the %(2v:+:-)  --  psvar[2] was set depending upon
> whether or not there are background jobs, %(2v:+:-) therefore gives a
> '+' if there are background jobs, or a '-' if not.
	The difference between this and the OP's request being
that you only know if there are backgrounded jobs, and not how many
there are.  Maybe it would be nice to be able to invoke jobs with a
process group leader argument, in which case it would (if perms were
correct, of course) show the job list for the shell with that PID,
rather than the current shell, so that people could do something
like

PS1="[$(jobs -P $$ | wc -l)]rest_of_prompt"

	?  (Actually, it would probably be better to just add a
% macro for "number of current jobs", though I don't think it's really
important enough to warrant either.)

	-- Sweth.

-- 
Sweth Chandramouli ; <svc@xxxxxxxxx>
President, Idiopathic Systems Consulting

Attachment: pgplmTVSqLtbu.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author