ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Westerman <dlwes...@us.ibm.com>
Subject Re: Issues With Quotes
Date Wed, 06 Nov 2013 14:34:33 GMT
Earl, thanks, that did it! I didn't even have to change the quotes on it, 
it worked just like this:

<arg value="&quot;@{file}&quot;" />

Having said all that, I actually changed this particular code to use the 
Ant 'resourcecontains' condition instead, when it hit me that I didn't 
need to use a Windows command for this.

Thanks!
DLW



From:   Earl Hood <earl@earlhood.com>
To:     Ant Users List <user@ant.apache.org>, 
Date:   11/05/2013 08:23 PM
Subject:        Re: Issues With Quotes
Sent by:        earlhood@gmail.com



On 11/5/13, Dave Westerman wrote:

> I'm passing in an attribute that contains a value to search for in a 
file
> in Windows. I'm doing this:
>
> <exec executable="cmd.exe"
>         resultproperty="retcode"
>         outputproperty="output">
>     <arg line="/c findstr /c:&quot;@{value}&quot; @{file}" />
> </exec>

I normally avoid using <arg line> since some additional parsing is done
by Ant (or the sub-shell), and it may mess things up.  Break up the
arguments like the following to see if things work:

  <exec executable="cmd.exe"
          resultproperty="retcode"
          outputproperty="output">
      <arg value="/c" />
      <arg value="findstr" />
      <arg value='/c:"@{value}"' />
      <arg value="@{file}" />
  </exec>

Note, not sure if the double-quotes are still required around @{value}
or not, you will have to test things out.  Windows batch (cmd.exe)
syntax is ugly, especially when dealing with quotes.

--ewh

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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message