From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5388 invoked from network); 5 May 2003 06:47:59 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 5 May 2003 06:47:59 -0000 Received: (qmail 26827 invoked by alias); 5 May 2003 06:47:47 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6069 Received: (qmail 26820 invoked from network); 5 May 2003 06:47:47 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 5 May 2003 06:47:47 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [192.35.17.28] by sunsite.dk (MessageWall 1.0.8) with SMTP; 5 May 2003 6:47:47 -0000 Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by goliath.siemens.de (8.11.7/8.11.7) with ESMTP id h456lku04358; Mon, 5 May 2003 08:47:46 +0200 (MEST) Received: from MOWD019A.mow.siemens.ru ([163.242.196.119]) by mail2.siemens.de (8.11.7/8.11.7) with ESMTP id h456lkA21780; Mon, 5 May 2003 08:47:46 +0200 (MEST) Received: by mowd019a.mow.siemens.ru with Internet Mail Service (5.5.2653.19) id ; Mon, 5 May 2003 10:51:46 +0400 Received: from mw2b210c (163.242.193.12 [163.242.193.12]) by MOWD019A.mow.siemens.ru with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id J908QFL0; Mon, 5 May 2003 10:51:44 +0400 From: Borzenkov Andrey To: "'Haakon Riiser'" , zsh-users@sunsite.dk Subject: RE: Scope of local parameters Date: Mon, 5 May 2003 10:47:38 +0400 Message-ID: <6134254DE87BD411908B00A0C99B044F05A0C913@mowd019a.mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 In-Reply-To: <20030501172022.GA4179@s.chello.no> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal > > Are there ways to limit the scope of local parameters besides > functions? Say you want to colorize the prompt, and you use > helper variables for the color escape sequences: > > local RED=... > local GREEN=... > local BLUE=... > > PS1= > > If I do this in ~/.zshrc, or a file sourced by .zshrc, the > variables declared local do not disappear after sourcing ~/.zshrc. > > One way to work around this is to wrap the PS1 initialization in > an auxiliary function, but then you have the same problem with > the scope of the function. :-) Alternatively, one could > > unset RED GREEN BLUE > > after setting PS1, but this doesn't feel quite right. What if > the parameters RED GREEN BLUE already existed? There has to be > a better way. > Would you please next time specify Zsh version? local foo=XXX "~/.zshrc" 127L, 1859C written bor@itsrm2% zsh bor@itsrm2% echo $foo bor@itsrm2% echo $ZSH_VERSION 4.1.1-test-1 -andrey