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:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; q=dns; s=default; b=Ht/9Iak 6LC4hK97sKNbtbH8If0SXG1XqldU98BSI4ty87gbhsYrlKSg+iOViOA3Xte18+bK Brgfsb48ZxeABA+vqEkwzuVVLqotvpduX0SSsz9SCiJccSylJio3JQlWwK87NMDE Ia2jEJIKNtjdbELCaa/kH39yBLjP1oE+edak= 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:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; s=default; bh=ntZk+Xe22UB6p s1Lh+RxLgPKGyY=; b=cfEP1WuGJccAz7AHzWThkvv08GsVaqcAkSiYsjn28W67p RRnE5uQgraxZU8xle7K6AM7Yiyg3pTDEtUmcXB2DvE7emnwCyde398zVN5zkVNuD QJlBKiBdSrhMKgg0+wOMD8xekBJtXt8ponBI7D/WGX204WjU1fgJEpse1UKlMk= 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=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=intact, WORKS X-HELO: mail-lf0-f50.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=OvWVsTM+XpATRlmusDQBNmFgT862cfS0ckM+4l4vY7w=; b=eN9f+F6CmqfoDj3Ad00/o6NHf/euhmSjkwMOngoTSSFbE5fcKRVamhaFrPYH4C4pN+ MDXsLKDUqjx+iZPF+43O/Z6KRlerb3VVLC4JIree3demviZBOl9O/axkNdeY2N9kxkaN FKXEuhj4I6xYiYTHjspgdZyGL5aHfgWca7MaBgHiKKewq3GZtlWBCwYSGR5QPW4+6wz5 FvynRl49LAlmBsmxfM8nHoYdERU7gY5IKvUP8fYYoOe9UzZa0tQcxRO6ivWPFEd3m+Cw LnD8P/ovzlPWXI1IxhqlGy0aPKBpVSCfgwl7KINXHxXKF/yGwHPJ/PxIsYkUos4f0OSB Eb1w== X-Gm-Message-State: AKGB3mKRmFwDLuaF/8j6ABw1OjnlpS/RcY8C4hII8xyjnTWODhN1okfI GQJ/8/Lla8uip5FiUzVX58ERMk2cGUEv7dtbYbNDMhnh X-Google-Smtp-Source: ACJfBoubc4gfdpjvkgrtFyHjteKX7bi3iJpQexamN3sobF+UVb9Ak6G4d0xwq5RyCsz7ZsKevnKuzYlAZNZNkAFPPJs= X-Received: by 10.46.84.65 with SMTP id y1mr15629638ljd.74.1514314455188; Tue, 26 Dec 2017 10:54:15 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <5a428a47.d0179d0a.4c14c.fe57@mx.google.com> References: <5a4087c1 DOT cdebca0a DOT a4e97 DOT 8eb3 AT mx DOT google DOT com> <5a428a47 DOT d0179d0a DOT 4c14c DOT fe57 AT mx DOT google DOT com> From: Dave Caswell Date: Tue, 26 Dec 2017 11:54:14 -0700 Message-ID: Subject: Re: Run command in new window To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes > 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" The '-v' option to cygstart gives the key to understanding this by showing what actually gets passed along by cygstart. WORKS: davec AT SodiumWin ~ $ cygstart -v bash -c " ' echo TT; sleep 5 ' " ShellExecute(NULL, "(null)", "bash", "-c ' echo TT; sleep 5 ' ", "(null)", 1) The quotes surrounding the argument to -c get passed along to the executed bash. WORKS: davec AT SodiumWin ~ $ cygstart -v bash -c '"echo 1;read"' ShellExecute(NULL, "(null)", "bash", "-c "echo 1;read"", "(null)", 1) Same here, the echo and read are both contained in one argument to -c. DOES NOT WORK davec AT SodiumWin ~ $ cygstart -v bash -c 'echo\ 1;read' ShellExecute(NULL, "(null)", "bash", "-c echo\ 1;read", "(null)", 1) Without the quotes to group the echo and read together, when the executed bash breaks the line up into words, the -c only sees echo\ as its command. WORKS: davec AT SodiumWin ~ $ 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. Does this help at all? -- 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