ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin" <mgai...@hotmail.com>
Subject Re: Need help using exec to do "ls -rt1 | tail -1"
Date Fri, 04 Apr 2003 22:23:03 GMT
try
'>' instead of '|'
Martin
----- Original Message ----- 
From: "Matt Reason" <matt.reason@movielink.com>
To: "Ant Users List" <user@ant.apache.org>
Sent: Friday, April 04, 2003 2:23 PM
Subject: Need help using exec to do "ls -rt1 | tail -1"



That command returns the name of the newest file in the directory.  I
want to put that string into a property.

The exec task seems to hate the fact that one of my arguments is a pipe.

Does anyone have a workaround?

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>

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


Mime
View raw message