Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Environment Passed to Functions
- X-seq: zsh-workers 102
- From: Vinnie Shelton <shelton@xxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Environment Passed to Functions
- Date: Wed, 14 Jun 1995 16:17:51 -0400
- Reply-to: acs@xxxxxxxxxxxxx
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. ksh handles this differently; the variable is in the environment
for all the commands in the function. E.g.
~ Wed 14 16:08 % echo $ZSH_VERSION
2.6-beta9
~ Wed 14 16:12 % echo $LPDEST
~ Wed 14 16:13 % function foo {
> env >/dev/null
> env
> }
~ Wed 14 16:13 % LPDEST=foo foo | grep LPDEST
~ Wed 14 16:14 %
LPDEST is not set. Now for ksh:
~ Wed 14 16:15 % ksh
$ echo $LPDEST
$ function foo {
> env >/dev/null
> env
> }
$ LPDEST=foo foo | grep LPDEST
LPDEST=foo
$
I think the ksh behavior is more useful - it makes a function's environment
more like a shell script's. Opinions?
--Vin
Messages sorted by:
Reverse Date,
Date,
Thread,
Author