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=Alzi3lYAMIXn1kLE 9wtTJNFLXHbnvVEpNr0IrTFJROa+g6r5/BqHa+MyFQwXI7tmBfoN7gQSoH97eCbV 4Q49PH3igJrlmAFHw7IgocVtJgqSZW7DQ32xQrjGBpJGT4xM+qc6FX1JV3t52xOq zbN3TivEUZitcKIcUnHs5TKVWxU= 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=lVKtz0QRqJxFfEn4CS8eQM 6gU9g=; b=HMYnBJB6NGWG2NyAxPVrOTCjV9Wgw2Xm+NF2FVoXQNuqiMF7sS5itZ LgTJ3cBiiDx5rmMfAozRlLszZOIqKPzeJSj3AtHgrAjuegygXY/f/gaxQ3gndlba aPSDp/UBAX/fSZz/VxdB5vAZaDqMrvZX50pqMVkO2ODp/nodktlJg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=HContent-Transfer-Encoding:8bit X-HELO: mail-io0-f180.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=Yw3AeXTwvf7fDKfIQ9iPIHM93s+nwg4Osle3YKw674g=; b=q/oAJsqMiAmJe4bBzG7Tkx1F+5jYgRahZdXlYyKIBZecGrctCTxzPOtHr0G4erIHfw laM7/gPT00wJHEGodkZTnIZyxn9WEudD/T0PIcTu6S17SXRNV6BFS/mrHsJyT8J5xYaR rkrFLuhgnyOSzZFuCBzAz06lbE6Li5nAtSWhrsdc4e1XDSSJpJm/dqa96vjTOYx26fzR 0RJfD9NgPk2jEZ/gaePbOzEho2luFmJt6Q8YvZCtgAlAYoD7xKehgYcubu3Ca2E+NxCt CwiOBDWviwL647s4OQSQVIngvROX8b/wjzp7ZWBL8GrRQauJ1OrzU8reoCkP8TbPDvzT muJQ== X-Gm-Message-State: AKGB3mIziIXVMk2YAitVikvSUy4txUzFKBf2tHhb2EVB+3Zk58I72tm8 /zbvd8/RYjKXYTsRN2AEC/Wlgw== X-Google-Smtp-Source: ACJfBosbfRDzyaK6n2hxQxVV0rEBPBpWDuW0/xWTXYREXKxRP2dYkDReAtZw3eqOY/Enl+ZGWu9guw== X-Received: by 10.107.107.21 with SMTP id g21mr17840537ioc.86.1514414800712; Wed, 27 Dec 2017 14:46:40 -0800 (PST) Subject: Re: Run command in new window To: cygwin AT cygwin DOT com References: <5a42f476 DOT 8335ca0a DOT 1ba14 DOT 0c39 AT mx DOT google DOT com> Reply-To: cygwin AT cygwin DOT com From: cyg Simple Message-ID: <096b28f1-2e30-e371-f0b7-e090a24498f5@gmail.com> Date: Wed, 27 Dec 2017 17:46:37 -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: <5a42f476.8335ca0a.1ba14.0c39@mx.google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes On 12/26/2017 8:16 PM, Steven Penny wrote: > 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\' > Yes, it is going to break the bash -c command started by cygstart because $z is expanded on the command line with cygstart. So it becomes equivalent to $ bash -c 'echo '; read' which will not work. The follow combination is needed to echo a single quote from bash. $ bash -c "echo \'; read" So to translate to cygstart $ cygstart bash -c \"echo \\\'\; read\" $ export z="'" $ bash -c "echo \\${z}; read" $ 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 Quotes as well as variables need to be quoted. > 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 > Don't know. I do know that $ bash -c 'echo \'; read' fails to work when I think it should as the \ should cause the ' following it to be ignored by the command line processor. -- 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