From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13336 invoked by alias); 26 Dec 2017 22:44:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 13265 invoked by uid 89); 26 Dec 2017 22:44:16 -0000 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 Received: from mail-it0-f51.google.com (HELO mail-it0-f51.google.com) (209.85.214.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Dec 2017 22:44:15 +0000 Received: by mail-it0-f51.google.com with SMTP id f143so23973779itb.0 for ; Tue, 26 Dec 2017 14:44:14 -0800 (PST) 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) Received: from [192.168.0.19] (d4-50-42-50.try.wideopenwest.com. [50.4.50.42]) by smtp.gmail.com with ESMTPSA id c8sm9637583itg.15.2017.12.26.14.44.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Dec 2017 14:44:12 -0800 (PST) Subject: Re: Run command in new window To: cygwin@cygwin.com References: <5a42a5d2.6d249d0a.a7449.95a4@mx.google.com> Reply-To: cygwin@cygwin.com From: cyg Simple Message-ID: Date: Wed, 27 Dec 2017 01:11:00 -0000 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00264.txt.bz2 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