delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/09/09/13:46:01

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 9 Sep 2009 13:45:34 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: syntax for Cygwin bash invoking Win apps
Message-ID: <20090909174534.GD29151@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <796377 DOT 93249 DOT qm AT web30205 DOT mail DOT mud DOT yahoo DOT com> <f60fe000909090856q7ef9a3c1x3f54eeb6b13b0432 AT mail DOT gmail DOT com> <20090909160513 DOT GB29151 AT ednor DOT casa DOT cgf DOT cx> <f60fe000909090910p33546992v589a666b8f61bf76 AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <f60fe000909090910p33546992v589a666b8f61bf76@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
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, Sep 09, 2009 at 12:10:44PM -0400, Mark J. Reed wrote:
>On Wed, Sep 9, 2009 at 12:05 PM, Christopher Faylor wrote:
>>>>>> $ cmd /c echo "\"abc\""
>>>>>> "\"abc\""
>>>>>>
>>>>>> # Wahhh?!
>>>>>>
>>>>>> Anyone who knows the explanation would make me very grateful. I've tried
>>>>>> this with other Windows apps too, and the same weirdness seems to occur.
>>>
>>>Larry Hall:
>>>>>All of the above is consistent with bash shell quoting.
>>>
>>>No, it's really not. ??Those backslashes should be long gone by the
>>>time cmd.exe gets its arguments, yet it echoes them. ??It seems that
>>>the Cygwin version of bash stops short before doing some of the work
>>>it normally does itself on other systems, assuming the executed
>>>command will have its command line run through the preprocessor in the
>>>Cygwin DLL.
>>
>> Actually, I'd say that was cmd doing something funky. ??It's hard to believe
>> that bash was actually special-casing cmd.exe.
>
>I don't think it's special-casing cmd.exe.  I think some of the
>command line processing that is done by bash on Linux has been moved
>out of bash and into the DLL command line preprocessor on Cygwin.

Cygwin does quote individual arguments if they contain "special"
characters like quotes or spaces when sending a command-line to a
windows program.  It's up to the windows program to understand quoting.

I tried renaming cmd.exe to foo.exe and there is no difference in
behavior but a mingw program which just echoes arguments does the right
thing.  So, the bottom line is that you can't rely on quoting behavior
with cmd's built-in echo.

cgf

--
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

- Raw text -


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