delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/10/10:16:30

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-8.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4B97B788.2080206@redhat.com>
Date: Wed, 10 Mar 2010 08:15:20 -0700
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: allow executing a path in backslash notation
References: <720660 DOT 16774 DOT qm AT web88302 DOT mail DOT re4 DOT yahoo DOT com> <20100310092536 DOT GS6505 AT calimero DOT vinschen DOT de> <e6940be71003100203h297db699ua44ae9086bf64a72 AT mail DOT gmail DOT com> <4B97789F DOT 1060405 AT shaddybaddah DOT name> <416096c61003100254r754b96efy3fc8b4ea5c7f2908 AT mail DOT gmail DOT com>
In-Reply-To: <416096c61003100254r754b96efy3fc8b4ea5c7f2908@mail.gmail.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

--------------enig76B2242A2880C83CA79321C9
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 03/10/2010 03:54 AM, Andy Koppe wrote:
>>> $ builtin exec "$WINDIR\system32\cmd.exe" /C echo ok
>>> -bash: exec: C:\WINDOWS\system32\cmd.exe: not found
>>>
>> Is it me, or is the quoting all wrong? Doesn't backslash in the double
>> quote (") acts as an escape character. i.e \s =3D s, \c =3D c etc.
>=20
> http://www.gnu.org/software/bash/manual/bashref.html#Double-Quotes:
> The backslash retains its special meaning only when followed by one of
> the following characters: =E2=80=98$=E2=80=99, =E2=80=98`=E2=80=99, =E2=
=80=98"=E2=80=99, =E2=80=98\=E2=80=99, or newline.

That's bash's rules.  According to POSIX, "\n" has undefined behavior.
And in some other implementations, such as Solaris sh, "\n" is
interpolated by the shell as a newline.  Bash instead does the
interpolation when you use $'\n'.

But the moral of the story is that within "", it is only portable to use
\ if it is followed by one of the four bytes specifically documented by
POSIX.

--=20
Eric Blake   eblake AT redhat DOT com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enig76B2242A2880C83CA79321C9
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAkuXt4gACgkQ84KuGfSFAYAPXQCfTL0L72VA06Hv0wfj/8awIsxr
KxcAnicur6gBAdODtuxdJoBnebXFk10w
=7mDv
-----END PGP SIGNATURE-----

--------------enig76B2242A2880C83CA79321C9--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019