ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Reason" <matt.rea...@movielink.com>
Subject RE: echo "something" >> somefile
Date Thu, 04 Mar 2004 23:34:27 GMT


Thanks guys, ${line.separator} is the piece I was missing.

It works great now.

Cheers.


-----Original Message-----
From: Anderson, Kajsa [mailto:Kajsa.Anderson@thomson.com] 
Sent: Thursday, March 04, 2004 3:07 PM
To: 'Ant Users List'
Subject: RE: echo "something" >> somefile 


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
line...  

<target name="logit">
  <echo file="log" append="true">${buildNum}
${BuildDate}.${line.separator}</echo>
</target>

HTH

Kajsa Anderson

-----Original Message-----
From: Matt Reason [mailto:matt.reason@movielink.com]
Sent: Thursday, March 04, 2004 4:24 PM
To: user@ant.apache.org
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,
 
Matt
 
<!-- This keeps appending to the same line. -->
<target name="logit">
  <echo file="log" append="true">${buildNum} ${BuildDate}.</echo>
</target>
 
<!-- This works but makes my skin crawl. (and will be formated by my
IDE)-->
<target name="logit">
  <echo file="log" append="true">${buildNum} ${BuildDate}.
</echo>
</target>
 
<!-- This indents each line by two spaces. -->
<target name="logit">
  <echo file="log" append="true">${buildNum} ${BuildDate}.
  </echo>
</target>
 

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


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


Mime
View raw message