Can echo task work here? Below is a target to init the file and one to clear the file. (not quite, it writes 1 byte to the file)
<project name="clear"> <target name="init"> <echo file="file.txt"> first line second line third </echo> </target> <target name="clear"> <echo file="file.txt"/> </target> </project> --glenn On Mon, Mar 15, 2010 at 19:55, Antoine Levy-Lambert <anto...@gmx.de> wrote: > Hi, > > redirection is a feature of the shell, not of cat. > > You could use > <delete file="/var/log/testmsg" quiet="true"/> > <touch file="/var/log/testmsg"/> > > or > > <exec executable="sh" searchpath="bin"> > <arg value="cat"/> > <arg value="/dev/null"/> > <arg value=">"/> > <arg value="/var/log/testmesg"/> > </exec> > > > > Regards, > > Antoine > > > dr_jym wrote: > > I am using Ant 1.7.0 not Ant 1.7.1 that has "truncate" task. > > I have to empty the file using Ant 1.7.0. on Linux - file name is > > /var/log/testmesg, and it has read/write permissions for everybody. > > I tried the following: > > > > <ant default="truncate"> > > <target name="truncate"> > > <exec executable="cat" searchpath="bin"> > > <arg value="/dev/null"/> > > <arg value=">"/> > > <arg value="/var/log/testmesg"/> > > </exec> > > </target> > > </ant> > > > > and this does not empty the file. What am I doing wrong, or maybe there > is > > another was to clean up the file? > > Thanks. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@ant.apache.org > For additional commands, e-mail: user-h...@ant.apache.org > >