This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: pass arguments enclosed with double quotes from bash shell to windows program
- From: Eliot Moss <moss at cs dot umass dot edu>
- To: cygwin at cygwin dot com
- Date: Sat, 2 Apr 2016 16:19:23 -0400
- Subject: Re: pass arguments enclosed with double quotes from bash shell to windows program
- Authentication-results: sourceware.org; auth=none
- References: <CAEF1h+WELCS56_5Up2UBKbQxAhj37Rs50p3gojSceLSfOHyu3w at mail dot gmail dot com>
- Reply-to: moss at cs dot umass dot edu
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