delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/02/07/06:31:59

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Thu, 7 Feb 2002 11:29:47 +0000 (GMT Standard Time)
From: Richard Gilbert <R DOT Gilbert AT sheffield DOT ac DOT uk>
To: Pavel Tsekov <ptsekov AT syntrex DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Passing double quotes to DOS
In-Reply-To: <3C62623E.9040907@syntrex.com>
Message-ID: <Pine.WNT.4.43.0202071125060.-70797-100000@jrgilbert.shef.ac.uk>
Organization: University of Sheffield
X-X-Sender: cs1jrg AT impala DOT shef DOT ac DOT uk
MIME-Version: 1.0

> > I need to be able to pass double quotes to a program running under NT4/DOS
> > but I cannot find a way of doing so.  To illustrate the problem I have
> > written a trivial BAT file called e.bat which contains the single line
> >
> > echo %1
> >
> > If I run it from a DOS shell with a double quoted parameter it echoes the
> > parameter with the double quotes intact, e.g.
> >
> > C:>e.bat "abc"
> > C:>echo "abc"	(<-- the BAT file echoes the command)
> > "abc"
> >
> > However, if I run this program from a bash shell (or tcsh) in the cygwin
> > environment, I cannot find a way of passing the double quotes to the
> > program...
> >
> > $ e.bat "abc"
> > C:>echo abc
> > abc
> >
> > (as expected)
> >
> > $ e.bat "\"abc\""
> > C:>echo "\"abc\""
> > echo "\"abc\""
> >
> > $ e.bat '"abc"'
> > C:>echo "\"abc\""
> > echo "\"abc\""
>
> I dont understand the output of the last example ? Is it really the
> same like the output of the second sample or it's just copy and
> paste mistake ? (DISCLAIMER: My understanding of shell scripts is not
> that deep so if I'm asking something very stupid here, please ignore it)

It really is the same...

> > Note that both the last two result in the same command being passed to
> > the BAT file.
> >
> > Can anybody tell me how to do it?
>
> Does this help: e.bat \"abc\"

...and the above suggestion has exactly the same effect:

$ e.bat \"abc\"
C:>echo "\"abc\""
echo "\"abc\""

--
Richard Gilbert
Corporate Information and Computing Services
University of Sheffield, Sheffield, S10 2TN, UK
Phone: +44 114 222 3028   Fax: +44 114 222 3040


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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