On Fri, Dec 5, 2014 at 7:41 PM, Eric Fetzer <elstonk...@yahoo.com.invalid>
wrote:
>
> Note that I also tried:
> <exec executable="sort" dir=".">
>   <arg value="-u"/>
>   <arg file="existingFile"/>
>   <arg value=">"/>
>   <arg file="newFile"/>
> </exec>
>
> Which produced:  sort: stat failed: >: No such file or directory

Strange, I'd have thought the XML parser would choke before you even got to
running something. > is one of those reserved characters in XML, that must
be replaced with a "character entity", "&gt;" (w/o the quotes) in this case.

Beside the above, you are confusing <exec> for a shell :). "cmd args files
> out" is something the shell (sh, ksh, csh, tcsh, bash, zsh, etc...)
interprets (i.e. parses), i.e. it runs "cmd args file" and redirects the
output of that to a file calls "out".

If you look at https://ant.apache.org/manual/Tasks/exec.html, you'll see
<exec> supports an 'output' attribute for the "Name of a file to which to
write the output". So you likely want something like:

<exec executable="sort" dir="." output="newFile">
  <arg value="-u"/>
  <arg file="existingFile"/>
</exec>

There's also a more powerful way to redirect/filter/etc... using
https://ant.apache.org/manual/Types/redirector.html but the above should do
I think. --DD

Reply via email to