Subject: RE: Env variable name trouble
From: [email-masked] (Colin Peters)

3 Dec 1996 23:05:49 -0800
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: "'Soorya Kuloor'" <[email-masked]>
Original-Cc: "'GNU-Win32'" <[email-masked]>
Original-Sender: [email-masked]

Soorya Kuloor[SMTP:[email-masked]] wrote:
>I set an environment variable in bash with mixed case name, for example
>includeFilesDir as
>	export includeFilesDir=blablabla
>
>Then if I start a subshell, in the subshell the name of the env variable
>gets changed to INCLUDEFILESDIR, so
>	echo $includeFilesDir
>in the subshell does not work.
[big snip]
>
>Any help as to how to fix this problem, or a work around (other than using
>all upper case env
>variable names :-)) this problem will be greatly appreciated.

I'm sure that someone at Cygnus knows a lot more about this than me, but...
I remember seeing a reference in someone's code (Cygnus?) that Windows NT
retains the case of environment variables- kinda-sorta. I also remember
seeing somewhere else that environment variable names were being converted
to all uppercase to be compatible with the command shell in NT. I definitely
remember seeing some mention that if you search for environment variables
in a case sensitive manner you may not get your variable. I don't know if
Cygnus, or even MS's implementations of getenv are case sensitive or not,
though I wouldn't be particularly surprised if they were. In code you can
always search the _environ (or is it __environ) block yourself using
strcmpi (or is it stricmp), but in shells...

What it comes down to is: maybe you should use all uppercase environment
variable names. Of course I'm almost willing to bet money that what you are
dealing with is a bunch of shell scripts and/or makefiles which depend on
this feature and would be a major pain to fix.

It should, of course, be possible to get bash to use case-insensitive
environment variable naming. Of course, there is no doubt in my mind that
there are plenty of shell scripts out there which not only use case
sensitive names, but use multiple variables only differentiated by the
case of their names.

I guess one could work it out so that bash preserved the case of
environment variables when starting sub-shells, although god knows how
much code that might take. Depending on who's doing the conversion to
all uppercase and where, it could be easy... (good luck)

Colin.

-- Colin Peters - [email-masked]
-- Saga University Dept. of Information Science
-- Fundamentals of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/home.html

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".