ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Kajsa" <>
Subject RE: echo "something" >> somefile
Date Thu, 04 Mar 2004 23:06:35 GMT
This seems to work, and I think meets the "clean formatting" requirement
(<echo> & </echo> are on one line, though my mail client may wrap the

<target name="logit">
  <echo file="log" append="true">${buildNum}


Kajsa Anderson

-----Original Message-----
From: Matt Reason []
Sent: Thursday, March 04, 2004 4:24 PM
Subject: echo "something" >> somefile 

I am trying get ant to do the exact equivalent of:
echo "This is a line of text in a file" >> file.txt 
Note that I am appending to the file.
I want a text file in my build directory that has two columns:
Build_Number and Build_Date.  Each time I do a build, I want to add one
line to that file.
Ant keeps putting the output on the same line.  A solution is to put a
carriage return in the message itself, but that destroys my formatting -
something that I am obsessive about.   If I put the </echo> in the right
(formatted) spot, then I get all the tabs in my output file  (see below)
Is there a way to append a single line at the end of a file?  Or do I
need to call exec?   Why would echo in ant have been designed
differently than echo in all other languages?
Thanks in advance,
<!-- This keeps appending to the same line. -->
<target name="logit">
  <echo file="log" append="true">${buildNum} ${BuildDate}.</echo>
<!-- This works but makes my skin crawl. (and will be formated by my
<target name="logit">
  <echo file="log" append="true">${buildNum} ${BuildDate}.
<!-- This indents each line by two spaces. -->
<target name="logit">
  <echo file="log" append="true">${buildNum} ${BuildDate}.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message