From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9550 invoked from network); 20 Mar 2005 18:30:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Mar 2005 18:30:01 -0000 Received: (qmail 58833 invoked from network); 20 Mar 2005 18:29:51 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Mar 2005 18:29:51 -0000 Received: (qmail 28825 invoked by alias); 20 Mar 2005 18:29:44 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8613 Received: (qmail 28815 invoked from network); 20 Mar 2005 18:29:44 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 20 Mar 2005 18:29:44 -0000 Received: (qmail 57779 invoked from network); 20 Mar 2005 18:29:44 -0000 Received: from vms040pub.verizon.net (206.46.252.40) by a.mx.sunsite.dk with SMTP; 20 Mar 2005 18:29:40 -0000 Received: from candle.brasslantern.com ([4.11.1.68]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IDN00DEKY1ELG92@vms040.mailsrvcs.net> for zsh-users@sunsite.dk; Sun, 20 Mar 2005 12:29:39 -0600 (CST) Received: from candle.brasslantern.com (IDENT:schaefer@localhost [127.0.0.1]) by candle.brasslantern.com (8.12.11/8.12.11) with ESMTP id j2KITbvH009382 for ; Sun, 20 Mar 2005 10:29:37 -0800 Received: (from schaefer@localhost) by candle.brasslantern.com (8.12.11/8.12.11/Submit) id j2KITbAp009381 for zsh-users@sunsite.dk; Sun, 20 Mar 2005 10:29:37 -0800 Date: Sun, 20 Mar 2005 10:29:36 -0800 From: Bart Schaefer Subject: Re: defining real time variables for a shell In-reply-to: <20050320170559.GA30366@fruitcom.com> To: Zsh Users Message-id: <050320102936.ZM9380@candle.brasslantern.com> MIME-version: 1.0 X-Mailer: Z-Mail Lite (5.0.0 30July97) Content-type: text/plain; charset=us-ascii References: <20050320170559.GA30366@fruitcom.com> Comments: In reply to Eric Smith "defining real time variables for a shell" (Mar 20, 6:05pm) 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=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 On Mar 20, 6:05pm, Eric Smith wrote: > > These values need to be updated at least daily and must be > available to shells that are already open (I use screen and am > lazy). > > I am thinking maybe to use a preexec function that parses a file > with the values. You'd want precmd, rather than preexec, I think. It depends on what you want to do with the values. Re-parsing a file before every prompt or command may be overkill; at the least, look at the zsh/sched module and consider updating the variables less frequently. (People tend to ask "How do I train a cat to dance?" when what they really want to know is "How do I entertain twelve eight-year-olds for two hours?" A dancing cat might keep kids happy, but it might not be the right or best solution.) You say perhaps parse a file. Where do the values in the file come from? The values will go into shell variables. Why? Is it because you want to export them in the environment so external commands can reference them? If not, maybe there's no need for variables at all. Or maybe $USD could be an expression that computes the number value, and when you need the number you use ${(e)USD}. Just food for thought.