From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8572 invoked from network); 3 Jul 2005 21:57:37 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Jul 2005 21:57:37 -0000 Received: (qmail 56659 invoked from network); 3 Jul 2005 21:57:26 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Jul 2005 21:57:26 -0000 Received: (qmail 10572 invoked by alias); 3 Jul 2005 21:57:20 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9012 Received: (qmail 10562 invoked from network); 3 Jul 2005 21:57:19 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Jul 2005 21:57:19 -0000 Received: (qmail 55724 invoked from network); 3 Jul 2005 21:57:19 -0000 Received: from viefep14-int.chello.at (213.46.255.13) by a.mx.sunsite.dk with SMTP; 3 Jul 2005 21:57:15 -0000 Received: from Dingo ([213.47.104.218]) by viefep14-int.chello.at (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20050703215714.VWDV7053.viefep14-int.chello.at@Dingo> for ; Sun, 3 Jul 2005 23:57:14 +0200 From: Christian Taylor To: "zsh-users" Subject: reinventing print_exit_value Date: Sun, 3 Jul 2005 23:56:17 +0200 User-Agent: KMail/1.8 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200507032356.17308.cht@chello.at> X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Hi all, I recently decided that I want the exit code of the last command (if it's greater than 0) displayed after invoking it, like the PRINT_EXIT_VALUE option does, but in my own format. (I don't want to include it in my prompt.) I added the necessary code to the precmd function, which lead to the following undesired behaviour: % false (1) % (1) % To achieve the intended behaviour, I now let the preexec function set a variable to 1, and let the precmd function print the exit value only if this variable is set to 1 (afterwards setting it to 0). This works because the preexec function is only invoked if a real command is executed, not if you attempt to "execute" whitespace or nothing. However: is there a simpler way to achieve this? My solution seems a bit inelegant to me. Thanks, Christian