ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject How to get a pipe in an <exec>
Date Mon, 02 Oct 2000 10:38:20 GMT
I didn't think you could get a pipe into an <exec>'d command, but it turns
out you can. The way to do it is to execute "sh", then have the <arg> be
set to a line, with "-c cmd... | cmd... etc."  Because you have to quote
the command string to 'sh -c', you need to put &quot;'s at the beginning
and end. So it ends up being, for example:

<exec executable="sh" output="">
 <arg line="-c &quot;p4 changes -m1 @${p4client} | cut -d' ' -f2 |
sed -e 's/^/buildnum=/'&quot;"/>

Not terribly portable, I know, but I also know I'll never run this stuff
on anything that doesn't have a unix-type shell. (If anyone knows an
easier/better way, though, I'd like to hear about it.)



Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!

View raw message