delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/12/26/17:44:31

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:reply-to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=uxz4DTEIRbDV/gWB
eVBgMCUmlTf2cC95BV1R8nwSQgrmVsb/6E3QlsY2D6eqEV5omJFTIXc89gv4yHsr
5TUWL3qSJFR57OXd0rMVQiNGHM2jfRXlgQze0LESe7jQ22FexlD2i/XNrR66R82h
lTmfDGEEUBNWBbUqcQiQ1+QE8yA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:reply-to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=ux1YfktMzqcpFEta6nOtb8
UNWNo=; b=kOcPmFPpGzrtAJEeAXXXIT0CDkNEuTKHlVFaRphub/PHOqDFw7fmAH
BeQZgzGcFLwdxjJxxPPA/f1lfVPQmH5jaghYSexB1DPzcsF//1CRT342XRgyryJV
LrFbz5UW4Cjfld1MZ46myJ0ziQ20Dhna0tyO42iRRUSi3P866v0ps=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1267, HContent-Transfer-Encoding:8bit
X-HELO: mail-it0-f51.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:reply-to:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+FKCKMNrL5RUBZMOlKBTiejHoiv0Q41yoeb0WCN0AAI=; b=OCa4wthDKe3PEUdgVSXxi1lleXTWwf+xkF8Q9UM7MYN8T9BxA9slLffhWaRmyQeM45 K69XSFVece/F1sou0mGLPvOcWE3oRA6qO1YEQAcCIsDQ1OFGZxV+uaSOun83jBXnetv3 Jh2Kmg7t3oc+wiFyzF3YJEyMeo1BRJF+swO5lCjhc1racAe2VMG8IU0TCCkLIlRIdJ4M 0b/C+XEKD2hHEUfKSBtfQqRopn1SqUxbJ+dhMZszRUAgBz2qiVS95K4PQBqmD2OMpXMd TcOqcmGSsrRr01tIPgxOoRHevZKvI2ElbtPX6uSah1JUyOsAkKF459Deo7a6q1S1ZzqW zBLQ==
X-Gm-Message-State: AKGB3mKZovwIrXogTjyGzXePHBb0VUeMb1Fmq25zRvqIG7RowEMi7TIU gf4kNajtmdUZygOuzBfF5sjsoA==
X-Google-Smtp-Source: ACJfBotbyE5t44Y4GOWFjXD1znqfCrHxSRPbNWKcNdKDld1H2Ug7Wnnb7Kk/gCoCcSi+riBzyfEhcQ==
X-Received: by 10.36.23.212 with SMTP id 203mr36229518ith.130.1514328253306; Tue, 26 Dec 2017 14:44:13 -0800 (PST)
Subject: Re: Run command in new window
To: cygwin AT cygwin DOT com
References: <CAG2dRtE19ot_Tk46djXUOOyX_gNSqTMiVWdWPepmAAQfrvEVVA AT mail DOT gmail DOT com> <5a42a5d2 DOT 6d249d0a DOT a7449 DOT 95a4 AT mx DOT google DOT com>
Reply-To: cygwin AT cygwin DOT com
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <e12dbeac-a27f-4f41-42c6-d5467433c553@gmail.com>
Date: Tue, 26 Dec 2017 17:44:11 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0
MIME-Version: 1.0
In-Reply-To: <5a42a5d2.6d249d0a.a7449.95a4@mx.google.com>
X-IsSubscribed: yes

On 12/26/2017 2:41 PM, Steven Penny wrote:
> On Tue, 26 Dec 2017 11:54:14, Dave Caswell wrote:
>> $ 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.
> 
> this is interesting, but it doesnt explain (or im not understanding) why
> it will
> accept a quoted string and not an escaped one. in a normal setting, these
> commands are identical:
> 
>    $ bash -c 'echo; read'
>    + bash -c 'echo; read'
> 
>    $ bash -c echo\;\ read
>    + bash -c 'echo; read'
> 
> but with cygstart this command works:
> 
>    cygstart bash -c '"echo; read"'
> 
> and this does not:
> 
>    cygstart bash -c 'echo\;\ read'

As I said earlier the quotes are interpreted by the shell executing the
command.  So the shell execing the cygstart command is not passing the
quote to the secondary bash session because it has interpreted them.  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\'

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019