From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14503 invoked from network); 17 Sep 2006 17:09:58 -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=AWL,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:09:58 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 77810 invoked from network); 17 Sep 2006 17:09:52 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Sep 2006 17:09:51 -0000 Received: (qmail 27451 invoked by alias); 17 Sep 2006 17:09:42 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10728 Received: (qmail 27441 invoked from network); 17 Sep 2006 17:09:40 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Sep 2006 17:09:40 -0000 Received: (qmail 76650 invoked from network); 17 Sep 2006 17:09:40 -0000 Received: from dan.emsphone.com (199.67.51.101) by a.mx.sunsite.dk with SMTP; 17 Sep 2006 17:09:39 -0000 Received: (from dan@localhost) by dan.emsphone.com (8.13.6/8.13.6) id k8HH9EFI085873; Sun, 17 Sep 2006 12:09:14 -0500 (CDT) (envelope-from dan) Date: Sun, 17 Sep 2006 12:09:14 -0500 From: Dan Nelson To: "arno." Cc: zsh-users@sunsite.dk Subject: Re: get output of a command in prompt Message-ID: <20060917170914.GE55663@dan.emsphone.com> References: <20060916184913.GA18417@localhost.localdomain> <20060916190154.GA24023@fsst.voodoo.lan> <20060917141420.GA5288@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20060917141420.GA5288@localhost.localdomain> X-OS: FreeBSD 6.1-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.13 (2006-08-11) In the last episode (Sep 17), arno. said: > Le Saturday 16 September 2006, à 21:01:55PM +0200, Frank a écrit : > > arno. : > > [..get output of command into prompt..] > > > > Take a look at this: > > > > [snip] > > zsh% PS1='$(printf "%s: %d" "This is a one" 1)-%% ' > > $(printf ": /home/hawk" "This is a one" 1)-% setopt promptsubst > > This is a one: 1-% > > [snap] > > Yes, I've tried things like that, but the problem is that command output > will be evaluated once, just when prompt is set up. It will not be > evaluated each time prompt is displayed That example does evalute the prompt each time it's printed; you just can't tell. Try with a command that changes its output: zsh% PS1='$(date)-%% ' ; setopt promptsubst Sun Sep 17 12:06:02 CDT 2006-% Sun Sep 17 12:06:33 CDT 2006-% Sun Sep 17 12:06:34 CDT 2006-% Of course in this example you'd be better off using zsh's builtin date-printing prompt escapes, but you get the idea. -- Dan Nelson dnelson@allantgroup.com