delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/04/02/16:20:01

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:reply-to:subject:references:to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=Tjaz3zSOrvRpVjKK
gEGIavBUp46eo19fP5A0fJG1dz72leqE9Aw5/UAyEds4me9bCNT5AK9ThUvC1gtp
nEmIER7mgR28kmIZ1VGv9uu833kj3azMgvXChp35REnes7Li0c74s2l/Hktoty5k
R3TAa2i7jHzndVux34smLRpdV34=
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:reply-to:subject:references:to:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=oI4hWZgdxg8oIN1k5CEzKY
pLx4c=; b=QXdVliA9NAehPzYfcisEOAXtWPyOL+wA7zG54AQDOf4QrJ9/otlSva
rfoflIVq5htOSc7qvKOtQZXIO4xbVo2lPIhzmsXhcEHZeIsmqBCMCi/2YzBUoFoP
tQSQoRTv/T58kczAnwagSU7pcCiGHxnlEzNstjqsoKHehq5+9WXYw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=moss, displaying, echoes, Moss
X-HELO: csmail.cs.umass.edu
Reply-To: moss AT cs DOT umass DOT edu
Subject: Re: pass arguments enclosed with double quotes from bash shell to windows program
References: <CAEF1h+WELCS56_5Up2UBKbQxAhj37Rs50p3gojSceLSfOHyu3w AT mail DOT gmail DOT com>
To: cygwin AT cygwin DOT com
From: Eliot Moss <moss AT cs DOT umass DOT edu>
Message-ID: <5700294B.6020308@cs.umass.edu>
Date: Sat, 2 Apr 2016 16:19:23 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <CAEF1h+WELCS56_5Up2UBKbQxAhj37Rs50p3gojSceLSfOHyu3w@mail.gmail.com>
X-IsSubscribed: yes

On 4/2/2016 2:59 PM, Cary Lewis wrote:
> I need to start acrobat from a bash shell.
>
> Acrobat needs some of its parameters to be enclosed with double
> quotes. This is needed to automatically open and print a pdf.
>
> When I try to do that directly from a bash shell, I can't get it to
> pass arguments enclosed with the double quotes.
>
> It will do that for arguments with spaces in them, but for single word
> arguments, it doesn't
>
> If I try to do a \", then it passes the \" to the windows app.
>
> The only workaround I've come up with so far, is to create a batch
> file in the bash shell, and then invoke it with a cmd /c batch.bat
>
> But there should be a way to control how arguments are passed.
>
> Does anyone have any ideas.

Have you tried:  '"arg"' ? bash should strip the ' ' and leave the " ".
Also, what about "\"foo\"" ?

My experiments with this suggest that they work.  I tried invoked a .bat
file that echoes its first argument, and it did show "\"foo\"", but I
suspect that is how echo renders "foo", i.e., it wraps it in quotes and
backslash protects the quotes.

Here's a function I use for invoking acrobat from the bash command line:

function acrobat () {
   local ARG
   [ -n "$1" ] && { ARG="$(cygpath -wa "$1")"; shift; }
   command acrobat ${ARG:+"${ARG}"} "$@" > /dev/null &
}

For it to work, acrobat needs to be on your path (I put a link in a directory
that is on my path).  Anyway, works fine for me to pop up acrobat displaying
a file.  I've not tired an incantation for printing ...

Best -- Eliot Moss

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

- Raw text -


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