ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Herr Christian Wolfgang Hujer <Christian.Hu...@itcqis.com>
Subject Re: Need help using exec to do "ls -rt1 | tail -1"
Date Fri, 04 Apr 2003 23:24:33 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Matt,

Am Freitag, 4. April 2003 23:23 schrieb Matt Reason:
> The exec task seems to hate the fact that one of my arguments is a pipe.
Seems so.

> Does anyone have a workaround?
I think it should work if you use sh as a command and pass your desired 
command line as argument to parameter c:
sh -c "ls -rt1 | tail -1"

> I think I've tried every possible permutation of this:
>
> <target name="getNewest">
>         <exec dir="${sourcedir}" executable="ls"
> outputproperty="theNewestFile">
>                 <!--
>                 <arg line="-rt1 | tail -1"/>
>                 -->
>                 <arg line="-rt1"/>
>                 <arg line="|"/>
>                 <arg line="tail"/>
>                 <arg line="-1"/>
>         </exec>
>         <echo message="The newest file in ${sourcedir} is:
> ${theNewestFile}"/>
> </target>

So you may try (didn't try myself)
<exec dir="${sourcedir}" executable="sh" outputproperty="theNewestFile">
	<arg line="-c" />
	<arg value="ls -rt1 | tail -1" />
</exec>

I hope this will work for you.


Bye
- -- 
ITCQIS GmbH
Christian Wolfgang Hujer
Geschäftsführender Gesellschafter
Telefon: +49  (0)89  27 37 04 37
Telefax: +49  (0)89  27 37 04 39
E-Mail: Christian.Hujer@itcqis.com
WWW: http://www.itcqis.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+jhQxzu6h7O/MKZkRAgFOAJ4s84dyFfrLSQFOzBqVQZ9e797alwCffJmD
nVtzwHkiebjhMPwpodNdaBg=
=dTEa
-----END PGP SIGNATURE-----


Mime
View raw message