Web lists-archives.com

Re: Run command in new window




On 12/26/2017 12:43 PM, Steven Penny wrote:
> On Sun, 24 Dec 2017 21:08:17, Steven Penny wrote:
>> that did it - thanks - this also works:
>>
>>     cygstart bash '-c "echo hello; read z"'
>>
>> seems like a problem with cygstart parser? here is the syntax:
>>
>>     cygstart [OPTION]... FILE [ARGUMENTS]
>>
>> so should support multiple arguments - this command works as expected
>>
>>     cygstart touch 1 2 3
>>
>> maybe the hyphen in "-c" is causing the problem?
> 
> update - cygstart does support multiple arguments, but any spaces will
> cause a
> problem. for example this command works fine:
> 
>    cygstart bash -c 'echo;read'
> 
> but this fails
> 
>    cygstart bash -c 'echo 1;read'
> 
> 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"


This has to do with the where the interpretation of the quote marks are
read.  The -c option for bash expects a quoted command but the quotes
are being interpreted by the parent shell executing the cygstart
command.  The quotes are not interpreted by cygstart itself.

$ cygstart bash -c \'echo 1\;read\'

-- 
cyg Simple

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