You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by "sean.egan@cm-logic.com" <se...@cm-logic.com> on 2004/01/16 17:04:47 UTC

Quoting arguments for an exec

Hi,

I'm trying to run a ClearCase command (cleartool mkattr), and I'm
using the Commandline class to build the arguments.
There is one argument that needs to have both single and double quotes
around it to make sure it's passed to cleartool properly.

On Unix: cleartool mkattr TestAttr '"test value"'  foo.c

This problem only exists for Unix platforms as a Windows shell will
allow me to escape argument.

On Win32: cleartool mkattr TestAttr \"test value\"  foo.c

The Commandline class checks for the use of single and double quotes
in the same argument and throws an exception when found.
Thus my command fails on Unix :-(

Does anyone have a suggestion for me to get around this?

Thanks, Sean.


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



Re: Quoting arguments for an exec

Posted by Peter Reilly <pe...@corvil.com>.
Just try to use a single " as follows:
<exec executable="echo">
    <arg value="&quot;test value&quot;"/>
</exec>

from the command line the ' in your example will be dropped
by the shell before reaching the cleartool.

Peter
sean.egan@cm-logic.com wrote:

>Hi,
>
>I'm trying to run a ClearCase command (cleartool mkattr), and I'm
>using the Commandline class to build the arguments.
>There is one argument that needs to have both single and double quotes
>around it to make sure it's passed to cleartool properly.
>
>On Unix: cleartool mkattr TestAttr '"test value"'  foo.c
>
>This problem only exists for Unix platforms as a Windows shell will
>allow me to escape argument.
>
>On Win32: cleartool mkattr TestAttr \"test value\"  foo.c
>
>The Commandline class checks for the use of single and double quotes
>in the same argument and throws an exception when found.
>Thus my command fails on Unix :-(
>
>Does anyone have a suggestion for me to get around this?
>
>Thanks, Sean.
>
>
>--------------------------------------------------------------------
>mail2web - Check your email from the web at
>http://mail2web.com/ .
>
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org