ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: Excute shell command
Date Tue, 14 Jul 2009 17:50:15 GMT
I could simply tell you to use the exec task:

<exec executable="/bin/bash"
    outproperty="KAR">
    <arg line="echo $var | awk -F '{print $4}'"/>
</exec>

However, there must be a better way to get this particular information:

You can use <property env="ENV"/>, and that would put the value of $var into
a property called "ENV.var". Now, to parse it a bit. That could be done with
resources and token filtering. See <
http://ant.apache.org/manual/CoreTypes/filterchain.html> and <
http://ant.apache.org/manual/CoreTypes/filterchain.html#tokenfilter> for
more information.

If ${var} came from a file that you're now attempting to parse, it should be
fairly easy to setup a filter reader on a file, find the line, and pull out
the fourth value on that line. Otherwise, you'll be attempting to parse a
property, and that's a bit harder to setup.

On Tue, Jul 14, 2009 at 8:53 AM, <jhoomsharabi@netscape.net> wrote:

> Hi All,
>
> I am stuck to shell command execution in my build.xml file, I want to
> execute the following command from my build.xml file:
>
> KAR=`echo $var | awk -F. '{print $4}'`
>
> Can anyone help me out in this?
>
> Thanks in advance.
>



-- 
David Weintraub
qazwart@gmail.com

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