This is the mail archive of the
mailing list for the Cygwin project.
Re: syntax for Cygwin bash invoking Win apps
- From: "Larry Hall (Cygwin)" <reply-to-list-only-lh at cygwin dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 09 Sep 2009 00:39:42 -0400
- Subject: Re: syntax for Cygwin bash invoking Win apps
- References: <firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
On 09/08/2009 11:30 PM, Ziser, Jesse wrote:
When I type a command in bash to invoke a Windows application (like
cmd.exe, for example), I can't seem to find a pattern in the Windows command
line that actually gets executed. Ordinary bash syntax does not seem to
apply in general when the command is a Windows app, but rather, sometimes
special characters are interpreted in a bash-like way, and sometimes not.
So, I'm wondering what determines whether a quote mark or something gets
interpreted or passed on.
Here are some examples:
$ cmd /c echo "/?"
Displays messages, or turns command-echoing on or off.
ECHO [ON | OFF]
Type ECHO without parameters to display the current echo setting.
# OK, so I'm getting the Windows echo, not the bash echo. Good.
# Moving on...
$ cmd /c echo abc
$ cmd /c echo "abc"
$ cmd /c echo "\"abc\""
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.
All of the above is consistent with bash shell quoting. It's the shell that
the interpreting in the Unix/Linux world and that's what you're seeing here.
On a related note, I've noticed what appears to be an automatic sort of
half-bash invocation (but not quite?) or something when I run Cygwin
commands from cmd.exe. For example,
myfile myotherfile yetanotherfile ...
What the heck is going on? Are there any rules here at all? Sorry if I'm
missing something dumb. And sorry for apologizing for it. And......
In this case, the Cygwin DLL intercedes and handles quoting for the Cygwin
you invoked (echo). But it only does quoting. You're mixing the notion of
environment handling. They are two different things.
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
216 Dalton Rd. (508) 893-9889 - FAX
Holliston, MA 01746
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple