Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

env variables

1 view
Skip to first unread message

Timothy Doyle

unread,
Apr 30, 1998, 3:00:00 AM4/30/98
to zsh-w...@math.gatech.edu

Hi, Ive been unsuccessfully trying to solve a problem for a while now, and
finally thought to toss pride to the side and ask for help.

The problem seems to be that certain programs do not recognize the existence
of certain environment variables. The programs are CVS, man, and JDK javac,
and the variables are CVSROOT, MANPATH, and CLASSPATH respectively. I had
forgotten about the problem until I just recently changed shells at my new
job (from csh to zsh), effectively disabling both man and javac. The
problem seems to be with variables previously (in csh) set with setenv.

I would love to hear any advice you have on this matter.

Timothy Michael Doyle
-----------------------------------------------
tdo...@firstquadrant.com
626.683.4232 (work)
626.449.0181 (home)
107 South Chester Avenue #5, Pasadena, CA 91106


Nik Gervae

unread,
Apr 30, 1998, 3:00:00 AM4/30/98
to Timothy Doyle

> The problem seems to be that certain programs do not recognize the existence
> of certain environment variables. The programs are CVS, man, and JDK javac,
> and the variables are CVSROOT, MANPATH, and CLASSPATH respectively. I had
> forgotten about the problem until I just recently changed shells at my new
> job (from csh to zsh), effectively disabling both man and javac. The
> problem seems to be with variables previously (in csh) set with setenv.

I've had this problem with the lowercase "cdpath" environment variable
too. A program here at work looks for it and under zsh it comes back
null. CDPATH exists, of course, but the program I mention doesn't look
for that....

--Nik
Nothing is easy.

);


env = getenv(argv[1]);
printf("%s\n", argv[1]);
printf("%s\n", env);
exit(EXIT_SUCCESS);
}

This is all in version 3.0.5.

--Nik


Bart Schaefer

unread,
May 4, 1998, 3:00:00 AM5/4/98
to zsh-w...@math.gatech.edu

On May 4, 3:39am, Geoff Wing wrote:
} Subject: Re: env variables
}
} Nik Gervae <N...@pdi.com> typed:
} :> Arrays aren't exported, because there's no standard or de facto
} :> method of exporting arrays, so nothing would understands them
} :Hmm. That sounds slightly fishy in that csh happily exports array
} :variables, but then csh is bogus in so many ways....
}
} Not as arrays. In fact, I can't see it doing it at all.

The problem is not really with exporting arrays ... the problem is with
exporting a variable whose name happens to be the same as one of zsh's
special array variables.

In the case in question, some program wants a variable named "cdpath" to
be in the environment. It probably expects that to be a colon-separated
string, but it doesn't really matter what it expects, because zsh won't
put a variable named "cdpath" in the environment. It actively removes
such a variable from the environment if it happens to be there when the
shell starts up.

This is one reason I've always preferred csh's model of keeping local
and environment variables in completely separate namespaces. (The icky
bit about the csh model is that you still refer to both with $xxx, so
you can't tell what namespace you're referencing.) (No, zsh should not
change models.)

The only workaround is to export the variable for a single command only,
like so:

cdpath=$CDPATH printenv

In older versions of zsh, that would have clobbered both cdpath and CDPATH
for the current shell, but fortunately that's fixed in current releases
so you can use it safely.

Hmm; hey, Peter, another FAQ entry?

--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com


0 new messages