X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,TW_YG,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <2BF01EB27B56CC478AD6E5A0A28931F2013024D9@A1DAL1SWPES19MB.ams.acs-inc.net> References: <2BF01EB27B56CC478AD6E5A0A28931F2013024D9 AT A1DAL1SWPES19MB DOT ams DOT acs-inc DOT net> Date: Wed, 4 Aug 2010 10:36:55 -0600 Message-ID: Subject: Re: incompatible environment variable names From: Steven Collins To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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: 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. 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). 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