Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <42E2A76E.5F686BC0@dessent.net>
Date: Sat, 23 Jul 2005 13:24:14 -0700
From: Brian Dessent <brian@dessent.net>
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Error using cygstart command with option arguments: "cygstart: bad   argument"
References: <20050723194252.38651.qmail@web30211.mail.mud.yahoo.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Report: -5.9/5.0 ---- Start SpamAssassin results  	* -3.3 ALL_TRUSTED Did not pass through any untrusted hosts 	* -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% 	*      [score: 0.0000] 	*  0.0 AWL AWL: From: address is in the auto white-list 	---- End SpamAssassin results
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com

Peter Farley wrote:

> I tried to use cygstart to execute bash with the "-c"
> option to execute a command and then terminate.
> Here's what I get:
> 
> $ cygstart bash -c echo Hi There
> cygstart: bad argument -c: unknown option

The problem that you are running into is that you need to tell cygstart
that the -c and following arguments are meant for the child process, and
are not arguments to cygstart itself.  '--' is a standard way of doing
this, which indicates to the program that all of the following arguments
should not be interpreted as switches but just regular data.  So
"cygstart -- bash -c ..." ought to work.

You will have to be careful with the quoting of the stuff after -c
though.  Cygstart is designed to use Windows-native methods to start a
process.  If you're using it to start a Cygwin process, and you want to
have an argument with spaces in it (as is the case with any nontrivial
-c) then you will have to be very careful with how you use quotes to
ensure that the Cygwin->Windows->Cygwin conversion of the argv[] works
correctly.  It would be much simpler to do something like: rxvt -e bash
-c "echo whatever".

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

