This is the mail archive of the
cygwin
mailing list for the Cygwin project.
incompatible environment variable names
- From: "Nellis, Kenneth" <Kenneth dot Nellis at acs-inc dot com>
- To: <cygwin at cygwin dot com>
- Date: Wed, 4 Aug 2010 11:23:13 -0500
- Subject: incompatible environment variable names
I came across an interesting (IMHO) incompatibility between
Windows and bash environment variable names.
I have a Windows environment variable as such:
C:\>set QNX_VISUAL_C++_PATH
QNX_VISUAL_C++_PATH=C:\Program Files\Orbital Qnx VisualC++ IDE
So, Windows has no problem with + symbols in variable names, but
bash does, kinda sorta:
Cygwin> printenv QNX_VISUAL_C++_PATH
C:\Program Files\Orbital Qnx VisualC++ IDE
Cygwin> cygpath "$QNX_VISUAL_C++_PATH"
++_PATH
Cygwin> echo "$QNX_VISUAL_C++_PATH"
++_PATH
Cygwin> echo ${QNX_VISUAL_C++_PATH}
Cygwin> cygpath "$(printenv QNX_VISUAL_C++_PATH)"
/cygdrive/c/Program Files/Orbital Qnx VisualC++ IDE
Cygwin>
So, it seems that I can only access the value of the variable
through printenv, and then cygpath does what I need, but I can't
then assign it back to the environment variable:
Cygwin> export QNX_VISUAL_C++_PATH="$(cygpath "$(printenv QNX_VISUAL_C++_PATH)")"
-bash: export: `QNX_VISUAL_C++_PATH=/cygdrive/c/Program Files/Orbital Qnx VisualC++ IDE': not a valid identifier
Cygwin>
I probably need to give up on this, but felt like sharing my misery.
--Ken Nellis