From: Dave Caswell <dave.caswell@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Run command in new window
Date: Tue, 26 Dec 2017 19:41:00 -0000 [thread overview]
Message-ID: <CAG2dRtE19ot_Tk46djXUOOyX_gNSqTMiVWdWPepmAAQfrvEVVA@mail.gmail.com> (raw)
In-Reply-To: <5a428a47.d0179d0a.4c14c.fe57@mx.google.com>
> and for some reason any spaces must be quoted - not escaped - these work:
>
> cygstart bash -c '"echo 1;read"'
> cygstart bash -c "'echo 1;read'"
>
> these fail:
>
> cygstart bash -c 'echo\ 1;read'
> cygstart bash -c "echo\ 1;read"
The '-v' option to cygstart gives the key to understanding this by
showing what actually gets passed along by cygstart.
WORKS:
davec@SodiumWin ~
$ cygstart -v bash -c " ' echo TT; sleep 5 ' "
ShellExecute(NULL, "(null)", "bash", "-c ' echo TT; sleep 5 ' ", "(null)", 1)
The quotes surrounding the argument to -c get passed along to the executed bash.
WORKS:
davec@SodiumWin ~
$ cygstart -v bash -c '"echo 1;read"'
ShellExecute(NULL, "(null)", "bash", "-c "echo 1;read"", "(null)", 1)
Same here, the echo and read are both contained in one argument to -c.
DOES NOT WORK
davec@SodiumWin ~
$ cygstart -v bash -c 'echo\ 1;read'
ShellExecute(NULL, "(null)", "bash", "-c echo\ 1;read", "(null)", 1)
Without the quotes to group the echo and read together, when the
executed bash breaks the line up into words, the -c only sees echo\ as
its command.
WORKS:
davec@SodiumWin ~
$ cygstart -v bash -c \'echo 1\;read \'
ShellExecute(NULL, "(null)", "bash", "-c 'echo 1;read '", "(null)", 1)
By escaping the quotes and semicolon so they get passed along intact,
the executed bash also gets an intact command string.
Does this help at all?
--
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
next prev parent reply other threads:[~2017-12-26 18:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-25 3:50 Steven Penny
2017-12-25 4:06 ` Andrey Repin
2017-12-25 4:37 ` Steven Penny
2017-12-25 4:54 ` Dave Caswell
2017-12-25 5:11 ` Steven Penny
2017-12-26 17:43 ` Dave Caswell
2017-12-26 18:54 ` Steven Penny
2017-12-26 19:12 ` Steven Penny
2017-12-26 19:41 ` Dave Caswell [this message]
2017-12-26 23:44 ` Steven Penny
2017-12-27 1:11 ` cyg Simple
2017-12-27 1:16 ` Steven Penny
2017-12-27 1:38 ` Jürgen Wagner
2017-12-27 22:46 ` Steven Penny
2017-12-27 9:39 ` Steven Penny
2017-12-28 12:07 ` cyg Simple
2017-12-28 20:11 ` Steven Penny
2017-12-26 22:44 ` cyg Simple
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAG2dRtE19ot_Tk46djXUOOyX_gNSqTMiVWdWPepmAAQfrvEVVA@mail.gmail.com \
--to=dave.caswell@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).