This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Run command in new window
- From: Steven Penny <svnpenn at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 26 Dec 2017 17:16:38 -0800 (PST)
- Subject: Re: Run command in new window
- Authentication-results: sourceware.org; auth=none
- References: <e12dbeac-a27f-4f41-42c6-d5467433c553@gmail.com>
On Tue, 26 Dec 2017 17:44:11, cyg Simple wrote:
If you want to pass quotes to the process on the command line then you need
to quote them or use a backslash on the quote to prevent the shell doing
the exec to process them.
$ cygstart bash -c \'echo 1\; read\'
continuing from my previous email [1], here is an example of your command in
action:
$ z=1
$ cygstart bash -c \'echo $z\; read\'
and here is something that breaks your example:
$ z=\'
$ cygstart bash -c \'echo $z\; read\'
so you see, your command assumes that no single quotes will be between the
single quotes, which is just not robust. it seems something like one of these
will be needed:
- bash printf %q
- coreutils printf %q
- homebrew function [2]
[1] http://cygwin.com/ml/cygwin/2017-12/msg00263.html
[2] http://github.com/svnpenn/stdlib/blob/45df8cf/libstd.awk#L318-L326
--
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