delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/23/18:05:31

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Sat, 23 Jul 2005 18:05:23 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Peter Farley <pjfarley3 AT yahoo DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Error using cygstart command with option arguments: "cygstart: bad argument"
In-Reply-To: <20050723213851.97600.qmail@web30212.mail.mud.yahoo.com>
Message-ID: <Pine.GSO.4.61.0507231802020.18510@slinky.cs.nyu.edu>
References: <20050723213851 DOT 97600 DOT qmail AT web30212 DOT mail DOT mud DOT yahoo DOT com>
MIME-Version: 1.0

Ugh, top-posting.  Reformatted.

On Sat, 23 Jul 2005, Peter Farley wrote:

> --- Brian Dessent <brian AT XXXXXXX DOT XXX> wrote:

<http://cygwin.com/acronyms/#PCYMTNQREAIYR>.  Thanks.

> > 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".
>
> Thank you Brian, I will try both of those.
> Fortunately none of the aruments I may need to use for
> the real application will contain spaces, but it is
> good advice that I will remember nonetheless.

Peter, beware that the need for quoting isn't just for spaces, but for any
shell and cmd metacharacters (they are different).  So, for example, any
use of '^' or '&' or '>' needs to be properly quoted *after* the
conversion Brian mentioned.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA

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

- Raw text -


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