ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Clark" <robert.cl...@quest.com>
Subject Re: ant run command piping and get out put to value
Date Mon, 12 Feb 2007 18:45:22 GMT
On Monday February 12, 2007, "Peter Reilly" 
<peter.kitt.reilly@gmail.com> wrote:
> On 2/12/07, James Abley <james.abley@volantis.com> wrote:
> > Probably something like:
> >
> > <exec executable="/usr/bin/svn">
> >     <arg line="info" />
> >     <arg line="|" />
> >     <arg line="/bin/grep" />
> >     <arg line="Revision" />
> > </exec>
>
> or:
>     <exec executable="sh">
>       <arg value = "-c"/>
>       <arg value="ls -rtla | grep build"/>
>     </exec>
> (note: in the second example, one does not need to use
> single quotes, also this will probably not work in windows with
> cygwin).

In this specific case, a redirector on the exec task with an output 
filter will duplicate the behaviour of piping through grep and has 
the benefit of being cross-platform. Something like:

<exec executable="svn">
    <arg value="info"/>
    <redirector outputproperty="svninfo">
        <outputfilterchain>
            <linecontains>
                <contains value="version"/>
            </linecontains>
        </outputfilterchain>
    </redirector>
</exec>

- Rob



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


Mime
View raw message