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

Re: A job signaller



In the last episode (Oct 29), Zefram said:
> Paolo Pumilia wrote:
> >Is there a way to put a mark within the prompt string to
> >inform the user that jobs are still running from that shell?
> >(e.g +/-: "+" for running or stopped jobs; "-" for no jobs)
> 
> I use something like this:
> 
> precmd () {
>   if jobs % >& /dev/null; then
>     psvar=("")
>   else
>     psvar=()
>   fi
> }
> PS1="%(1v:+:-)> "

Note that a side-effect of this is that an "exit" will not warn you
that you have jobs running.  The "jobs" comand in the precmd() function
clears the variable that would cause the warning to be printed.

	-Dan Nelson
	dnelson@xxxxxxxxxxxx



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