Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: get the number of active jobs to show in the prompt?
- X-seq: zsh-users 4303
- From: Drew Perttula <drewp@xxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: get the number of active jobs to show in the prompt?
- Date: Sun, 30 Sep 2001 23:59:21 -0700
- In-reply-to: Your message of "Mon, 01 Oct 2001 08:37:58 +0200." <20011001083758.A12916@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
> Actually, what I have is this:
> precmd () {
> local exitstatus=$?
> psvar[1]=SIG
> [[ $exitstatus -ge 128 ]] && psvar[1]=SIG$signals[$exitstatus-127]
> [[ $psvar[1] = SIG ]] && psvar[1]=$exitstatus
> jobs % >& /dev/null && psvar[2]="" || psvar[2]=()
> }
> [ switch PS1 depending upon $TERM, but for xterm: ]
> PS1=': %2(L.%U[%L]%u.)%(?..%B{%v}%b)%(2v:+:-)%n@%m:%l(%!)%30<..<%~%#; '
>
> 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.
It seems like the + and - come at the reverse times than you say,
but, just the same, this looks like what I want.
Thanks everyone for the quick responses!
-Drew
Messages sorted by:
Reverse Date,
Date,
Thread,
Author