| delorie.com/archives/browse.cgi | search |
| 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: | <AANLkTi=W1mfktf7Nri6B=fYPHTxwSqa-6O3tDuQL6KnU@mail.gmail.com> |
| Subject: | Re: incompatible environment variable names |
| From: | Steven Collins <spc DOT for DOT nbc AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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:
<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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |