From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id SAA12985 for ; Thu, 15 Jun 1995 18:59:27 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA16831 (5.65c/Gatech-10.0-IDA for ); Thu, 15 Jun 1995 04:49:35 -0400 Received: by math (5.x/SMI-SVR4) id AA07619; Thu, 15 Jun 1995 04:46:31 -0400 Resent-Date: Thu, 15 Jun 95 09:46:41 +0100 Old-Return-Path: Message-Id: <28749.9506150846@pyro.swan.ac.uk> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: Environment Passed to Functions In-Reply-To: "shelton@grind.ICD.Teradyne.COM"'s message of "Wed, 14 Jun 95 16:17:51 EDT." <9506142017.AA13377@grind.icd.teradyne.com> Date: Thu, 15 Jun 95 09:46:41 +0100 From: P.Stephenson@swansea.ac.uk X-Mts: smtp Resent-Message-Id: <"5y6z62.0.zs1.cD_tl"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/103 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu shelton@grind.ICD.Teradyne.COM wrote: > If an environment variable is set on the command line for a function, then > that enviroment variable is only in effect for the first command in the > function. Actually, the problem is slightly different: for shell functions and builtins the parameter isn't put into the environment at all. This must be a bug. It looks to me like the simplest thing is to export the variable for a function, not for a builtin (the only two possibilities at that point in the code). *** Src/exec.c~ Mon Jun 5 10:34:30 1995 --- Src/exec.c Thu Jun 15 09:43:27 1995 *************** *** 1416,1422 **** } if (cmd->vars) { ! addvars(cmd->vars, 0); if (errflag) { lastval = 1; return; --- 1416,1425 ---- } if (cmd->vars) { ! /* Export this if the command is a shell function, ! * but not if it's a builtin. ! */ ! addvars(cmd->vars, cn1->flags & SHFUNC); if (errflag) { lastval = 1; return; -- Peter Stephenson Tel: +44 1792 205678 extn. 4461 WWW: http://python.swan.ac.uk/~pypeters/ Fax: +44 1792 295324 Department of Physics, University of Wales, Swansea, Singleton Park, Swansea, SA2 8PP, U.K.