ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <ddevie...@gmail.com>
Subject Re: Using shell command in ANT script
Date Wed, 24 Nov 2010 19:45:29 GMT
On Wed, Nov 24, 2010 at 3:48 AM,  <jhoomsharabi@netscape.net> wrote:
> I want to use the following shell command in my build.xml file
> ls -l ../../../jobs/ | awk '{ print $9 }' > content.txt

AFAIK, the 9th field of ls -l is the filename, so your "ls -l path |
awk '{ print $9 }'" is better replaced with simply "ls -1".

Then this becomes (untested):

<exec executable="ls" outputproperty="content.txt">
  <arg value="-1" />
  <arg file="../../../jobs" />
</exec>

But I'm sure there's a way to do it portably in pure Ant too, without
forking to ls. --DD

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


Mime
View raw message