This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Run command in new window


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]