From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5229 invoked from network); 29 Oct 1998 14:21:59 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 29 Oct 1998 14:21:59 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id JAA09963; Thu, 29 Oct 1998 09:11:38 -0500 (EST) Resent-Date: Thu, 29 Oct 1998 09:11:32 -0500 (EST) Sender: alainc@griffon.sanga-mtl.com Message-ID: <363878CA.27586B27@sangacorp.com> Date: Thu, 29 Oct 1998 14:16:42 +0000 From: Alain Caron X-Mailer: Mozilla 4.06 [en] (X11; U; Linux 2.0.34 i586) MIME-Version: 1.0 To: pumilia@est.it CC: zsh-users@math.gatech.edu Subject: Re: A job signaller References: <19981029143654.A4064@wigner.cstc.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-Message-ID: <"pqQ5i1.0.1R2.KU7Es"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1893 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Paolo Pumilia wrote: > > Hi z-shell users, > 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) > > thank you for your suggestions > > Paolo Pumilia > > ---- cstc - I use the following in my .zshrc function precmd { if jobs % >& /dev/null; then psvar=("*") else psvar=("") fi } PS1="%~ %!%1v> " The precmd function is executed before printing a prompt. It checks whether there are background jobs or not. The %1v pattern in PS1 means to print the first element of the array psvar. If there background jobs, an asterisk is printed. Otherwise, an empty string is printed. It works fine for me. You would just have to modify the precmd to check whether the jobs are running or suspended and set psvar accordingly. Regards, Alain Caron alainc@sangacorp.com 514-288-4498 ext. 225