From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25509 invoked from network); 13 Aug 2004 03:38:21 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Aug 2004 03:38:21 -0000 Received: (qmail 12503 invoked from network); 13 Aug 2004 03:38:14 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Aug 2004 03:38:14 -0000 Received: (qmail 8846 invoked by alias); 13 Aug 2004 03:37:30 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7820 Received: (qmail 8836 invoked from network); 13 Aug 2004 03:37:30 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 13 Aug 2004 03:37:30 -0000 Received: (qmail 9101 invoked from network); 13 Aug 2004 03:35:31 -0000 Received: from sccimhc91.asp.att.net (63.240.76.165) by a.mx.sunsite.dk with SMTP; 13 Aug 2004 03:35:30 -0000 Received: from louisville.edu (12-220-223-80.client.insightbb.com[12.220.223.80]) by sccimhc91.asp.att.net (sccimhc91) with SMTP id <20040813033528i9100bv9a5e>; Fri, 13 Aug 2004 03:35:28 +0000 Date: Thu, 12 Aug 2004 23:35:26 -0400 Mime-Version: 1.0 (Apple Message framework v553) Content-Type: text/plain; charset=US-ASCII; format=flowed Subject: Execute a Command in PS1 w/o Disturbing Previous Return Value? From: Aaron Davies To: zsh-users@sunsite.dk Content-Transfer-Encoding: 7bit Message-Id: X-Mailer: Apple Mail (2.553) X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: ** X-Spam-Status: No, hits=2.5 required=6.0 tests=BAYES_44,FROM_ENDS_IN_NUMS, RCVD_IN_SORBS autolearn=no version=2.63 X-Spam-Hits: 2.5 I'm trying to write a prompt that will do two things: include a file frequently re-downloaded from the web, and indicate the return status of the previous command. The problem is, if I cat out the file, it returns 0, overwriting the return status read by the %(0?%) directive, and guaranteeing that I will always get a prompt indicating success. What can I do about this? Here's the whole line. The breakdown is: current temperature, pwd, (if last command successful, a green smiley, else a red frowny), prompt char. export PS1='`cat /tmp/temperature`'" %m%~ %(0?."`echo '%{\e[1;32m%}:)%{\e[0m%}'`"."`echo \ '%{\e[1;31m%}:(%{\e[0m%}'`") %# " (/tmp/temperature is refreshed every five minutes by a cron job, in case you were wondering.) -- __ __ / ) / ) /--/ __. .__ ______ / / __. , __o _ _ / (_(_/|_/ (_(_) / (_ (__/_(_/|_\/ <__