ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4911] - exec arguments convert single quote (apos) to full quote
Date Thu, 06 Dec 2001 15:47:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4911>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4911

exec arguments convert single quote (apos) to full quote





------- Additional Comments From bodewig@apache.org  2001-12-06 07:47 -------
There is nothing really wrong here, except that you shouldn't be using line
but value.

I start to think that we better should remove (or strongly rewrite) the -debug
output of <exec> as it is extremely misleading.  Ant doesn't use the shell at
all to invoke a command, so no quotes are needed at all and the debug line
is something very different from the command that gets actually executed.

I run on Redhat 7.2 Linux here and it has some strange version of nslookup, if I
run nslookup by hand I get:

[bodewig@bodewig jakarta-ant]$ nslookup -silent www.apache.org
Server:
	195.94.90.10
Address:
195.94.90.10#53

Non-authoritative answer:
Name:
www.apache.org
Address: 64.125.133.20

I will now use two exec tasks and couple them (so I don't need to run a shell)
using a poor man's pipe, read a temporary file.  The build file I use is

  <project default="default">
    <target name="default">
      <exec executable="nslookup" output="tmp.out">
        <arg line="-silent www.apache.org" />
      </exec>
      <exec executable="awk">
        <arg value="NR == 2 { print $$NF }" />
        <arg value="tmp.out" />
      </exec>
      <delete file="tmp.out" />
    </target>
  </project>

You see, no quotes at all - awk will get the program as a single argument
(because I use value instead of line).  The result is

default:
     [exec] 195.94.90.10#53
   [delete] Deleting: /tmp/tmp.out

BUILD SUCCESSFUL

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message