This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: environment variable name converted to upper case


To expand on what Chris wrote, this is caused by the fact that in
command.com (but not cmd.exe as supplied by XP - I don't know about earlier
versions of cmd.exe) all user-setable Windows environmental variable are
uppercase.  Try this in command.com:  
	> set
You will see all the environmental variable are uppercase.  Now
	> set zzz=aaa
	> set
will show that zzz is listed as
	ZZZ=aaa
Now
	> echo %ZZZ%
	aaa
	> echo %zzz%
	aaa
Note that in some versions of Windows, Windows itself sets a variable with a
lowercase name so that it would be impossible for the user to set it.
Windows 98se has
	windir=C:\WINDOWS
I can
	> set windir=xxx
and find that
	windir=C:\WINDOWS
is unchanged but I now have a variable
	WINDIR=xxx
But it cannot be accessed as seen by
	> echo %windir%
	C:\WINDOWS
	> echo %WINDIR%
	C:\WINDOWS
My guess is that on XP, cygwin.bat runs under command.com (which is
available under all versions of Windows), not cmd.exe (provided only with
NT/2k/XP).

As Chris said, the easiest way to set the variable is in the shell.  Under
NT/2k/XP, you might get the behavior you want by changing cygwin.bat to
cygwin.cmd, or running bash directly (if the variable is set in the global
environment).  You'll have to experiment.  For the record, under Windows
9x/Me, setting the environmental variable in the shell is probably the only
way to do it.

-----Original Message-----
From: Christopher Faylor [mailto:cgf-no-personal-reply-please@cygwin.com] 
Sent: Saturday, August 21, 2004 12:21 PM
To: cygwin@cygwin.com
Subject: Re: environment variable name converted to upper case

On Sat, Aug 21, 2004 at 09:30:53PM +0530, Koduru, Seshasai wrote:
>An environment variable name defined in windows environment with 
>lowercase is converted to uppercase by cygwin environment.
>
>Because of this behavior the shell scripts are not recognizing 
>$lowercase variable. Is this the regular expected behavior?

Yes.

>Is there any way to get the case preserved?

Don't set the environment variable at the windows level.  Set it in the
shell prior to running the program.

If that isn't adequate, then there probably isn't any way to do what you
want.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]