bodewig 2003/08/14 09:16:21 Modified: docs faq.html xdocs faq.xml Log: Avoid "useless use of cat" award by using a real world example. Revision Changes Path 1.76 +10 -9 ant/docs/faq.html Index: faq.html =================================================================== RCS file: /home/cvs/ant/docs/faq.html,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- faq.html 13 Aug 2003 06:11:58 -0000 1.75 +++ faq.html 14 Aug 2003 16:16:20 -0000 1.76 @@ -673,26 +673,27 @@ How do I redirect standard input or standard output in the <code><exec></code> task? </p> - <p>Say you want to redirect the standard input stream of the - <code>cat</code> command to read from a file, something + <p>Say you want to redirect the standard output stream of the + <code>m4</code> command to write to a file, something like:</p> <pre class="code"> -shell-prompt> cat < foo +shell-prompt> m4 foo.m4 > foo </pre> <p>and try to translate it into</p> <pre class="code"> -<exec executable="cat"> - <arg value="&lt;" /> - <arg value="foo" /> +<exec executable="m4"> + <arg value="foo.m4"/> + <arg value="&gt;"/> + <arg value="foo"/> </exec> </pre> - <p>This will not do what you expect. The input redirection is + <p>This will not do what you expect. The output redirection is performed by your shell, not the command itself, so this should read:</p> <pre class="code"> <exec executable="/bin/sh"> <arg value="-c" /> - <arg value="cat &lt; foo" /> + <arg value="m4 foo.m4 &gt; foo" /> </exec> </pre> <p>Note that you must use the <code>value</code> attribute of @@ -701,7 +702,7 @@ you can use:</p> <pre class="code"> <exec executable="/bin/sh"> - <arg line='-c "cat &lt; foo"'/> + <arg line='-c "m4 foo.m4 &gt; foo"'/> </exec> </pre> <p>Note the double-quotes nested inside the single-quotes.</p> 1.37 +10 -9 ant/xdocs/faq.xml Index: faq.xml =================================================================== RCS file: /home/cvs/ant/xdocs/faq.xml,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- faq.xml 13 Aug 2003 06:11:58 -0000 1.36 +++ faq.xml 14 Aug 2003 16:16:21 -0000 1.37 @@ -313,31 +313,32 @@ <question>How do I redirect standard input or standard output in the <code><exec></code> task?</question> <answer> - <p>Say you want to redirect the standard input stream of the - <code>cat</code> command to read from a file, something + <p>Say you want to redirect the standard output stream of the + <code>m4</code> command to write to a file, something like:</p> <source><![CDATA[ -shell-prompt> cat < foo +shell-prompt> m4 foo.m4 > foo ]]></source> <p>and try to translate it into</p> <source><![CDATA[ -<exec executable="cat"> - <arg value="<" /> - <arg value="foo" /> +<exec executable="m4"> + <arg value="foo.m4"/> + <arg value=">"/> + <arg value="foo"/> </exec> ]]></source> - <p>This will not do what you expect. The input redirection is + <p>This will not do what you expect. The output redirection is performed by your shell, not the command itself, so this should read:</p> <source><![CDATA[ <exec executable="/bin/sh"> <arg value="-c" /> - <arg value="cat < foo" /> + <arg value="m4 foo.m4 > foo" /> </exec> ]]></source> @@ -347,7 +348,7 @@ you can use:</p> <source><![CDATA[ <exec executable="/bin/sh"> - <arg line='-c "cat < foo"'/> + <arg line='-c "m4 foo.m4 > foo"'/> </exec> ]]></source>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]