On Wed, Aug 4, 2010 at 10:23, Nellis, Kenneth wrote: > 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 >
>From the bash man page: <bashManPage> <snip/> DEFINITIONS The following definitions are used throughout the rest of this document. blank A space or tab. word A sequence of characters considered as a single unit by the shell. Also known as a token. name A word consisting only of alphanumeric characters and underscores, and beginning with an alphabetic character or an underscore. Also referred to as an identifier. <snip/> PARAMETERS A parameter is an entity that stores values. It can be a name, a number, or one of the special characters listed below under Special Parameters. A variable is a parameter denoted by a name. A variable has a value and zero or more attributes. Attributes are assigned using the declare builtin command (see declare below in SHELL BUILTIN COMMANDS). <snip/> </bashManPage> Hench bash does not support the plus character in a variable name and no amount of finagling is going to fix it. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple