From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20433 invoked from network); 17 Sep 2006 17:22:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.5 (2006-08-29) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Sep 2006 17:22:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 90439 invoked from network); 17 Sep 2006 17:22:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Sep 2006 17:22:51 -0000 Received: (qmail 29198 invoked by alias); 17 Sep 2006 17:22:44 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10729 Received: (qmail 29189 invoked from network); 17 Sep 2006 17:22:43 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Sep 2006 17:22:43 -0000 Received: (qmail 89386 invoked from network); 17 Sep 2006 17:22:43 -0000 Received: from parhelion.firedrake.org (193.201.200.77) by a.mx.sunsite.dk with SMTP; 17 Sep 2006 17:22:43 -0000 Received: from phil by parhelion.firedrake.org with local (Exim 4.50 #1 (Debian)) id 1GP0Lq-0002mg-Ni for ; Sun, 17 Sep 2006 18:22:42 +0100 Date: Sun, 17 Sep 2006 19:22:42 +0200 From: Phil Pennock To: zsh-users@sunsite.dk Subject: Re: get output of a command in prompt Message-ID: <20060917172242.GA7825@parhelion.globnix.org> Mail-Followup-To: zsh-users@sunsite.dk References: <20060916184913.GA18417@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060916184913.GA18417@localhost.localdomain> Sender: Phil Pennock On 2006-09-16 at 20:49 +0200, arno. wrote: > So I have something like : > RPS1="%2v" > and > > precmd() { > gettemp > } > > Some people make the mistake of using it [precmd function] to set up a > > prompt, but there are enough ways of getting varying information into a > > fixed prompt string that you shouldn't do that unless you have very odd > > things in your prompt. > http://zsh.sunsite.dk/Guide/zshguide03.html#l51 > > But I didn't find a better way to do what I want. Did I miss something, > or is my goal something "very odd". I interpret the user guide text to mean "Don't set the prompt in precmd()", given the following text: "It's a big nuisance having to redefine precmd to alter your prompt --- especially if you don't know it's there, since then your prompt apparently magically returns to the same format when you change it." So they're saying that instead of using: function precmd { RPS1="$(gettemp)" } you should instead do exactly what you are doing. For a distributed example of using precmd, see the various prompt_*_setup routines; in particular, prompt_zefram_setup shows something manipulating various $psvar values for later display in the prompt. Regards, -Phil