From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id EAA02465 for ; Mon, 19 Aug 1996 04:41:29 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA09901; Sun, 18 Aug 1996 14:43:06 -0400 (EDT) Resent-Date: Sun, 18 Aug 1996 14:42:13 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960818114312.ZM23497@candle.brasslantern.com> Date: Sun, 18 Aug 1996 11:43:12 -0700 In-Reply-To: Robert Stone "zsh propmts" (Aug 18, 3:42am) References: Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.729 29jul96) To: Robert Stone , zsh-users@math.gatech.edu Subject: Re: zsh propmts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"eodfx1.0.6Q2.4Gs5o"@euclid> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/361 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Aug 18, 3:42am, Robert Stone wrote: } Subject: zsh propmts } } I've been attempting to set up a prompt that will show me any } non-zero return values, and print the names of any signal the last job } recieved. Right now I'm using two features of the shell to accomplish this: } } function precmd { PSVAR=$signals[$?^128+1] } } PROMPT='%(?..%1(?.{%?}.%B{%?%2(v.. %v)}%b) )%m:%~%# ' } } Unfortunately I end up with $PSVAR = '.' if no signal has occured This looks like a bug in the PSVAR handling. Note that PSVAR is a colon- separated list corresponding to the psvar array. Assignments to PSVAR are thus being treated in a manner similar to assignments to PATH, which means that PSVAR can never be made empty by direct assignment -- an empty assignment assigns dot instead. If you use psvar instead of PSVAR, things work better: function precmd { psvar=($signals[$?^128+1]) } PROMPT='%(?..%1(?.{%?}.%B{%?%2(v.. %v)}%b) )%m:%~%# ' Unfortunately, there also seems to be a bug with %2(v.. %v) because it evaluates to a space when $#psvar == 0. So it looks better this way: PROMPT='%(?..%1(?.{%?}.%B{%?%1(v. %v.)}%b) )%m:%~%# ' } The trick here is that I can't execute anything in precmd that would } effect $? or the "%?" value in the prompt is inaccurate. Really? That shouldn't be the case. $? is supposed to get reset to its original value after precmd exits. All you have to do is be sure that the assignment to psvar is the very first thing that happens in precmd. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern New male in /home/schaefer: >N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"