Re: <exec> kicking my butt with something very simple

Stefan Bodewig <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <[email protected]>
On 2014-12-05, Eric Fetzer wrote:

> I've tried all I can figure out to try on a simple unix command in
> redhat.  I can run the command line and it works fine, but ant can't
> run it to save its life:

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

> I've tried putting all the args together, putting some of the args
> together...  If I run it like this, I get "sort: stat failed: >: No
> such file or directory.

This is because stdout redirection is something the shell handles for
you on Unix and ant executes the command directly.

You can either use the task's output attribute to create newfile or
execute the command via the shell:

        <http://ant.apache.org/faq#shell-redirect-2>

Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.