bodewig 01/07/25 00:58:33
Modified: webpage/docs faq.html
webpage/xdocs faq.xml
Log:
Add FAQ entries for io-redirection via < and > in <exec>.
Somebody else will have to provide Windows details, if necessary 8-)
Revision Changes Path
1.13 +120 -0 jakarta-ant/webpage/docs/faq.html
Index: faq.html
===================================================================
RCS file: /home/cvs/jakarta-ant/webpage/docs/faq.html,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- faq.html 2001/07/13 08:56:21 1.12
+++ faq.html 2001/07/25 07:58:30 1.13
@@ -148,6 +148,13 @@
How can I use Jikes specific command line
switches?
</a></li>
+ <li><a href="#shell-redirect-1">
+ How do I include a < character in my command line arguments?
+ </a></li>
+ <li><a href="#shell-redirect-2">
+ How do I redirect standard input or standard output
+ in the <code><exec></code> task?
+ </a></li>
</ul>
</blockquote>
</td></tr>
@@ -560,6 +567,119 @@
</td>
</tr>
</table>
+ </blockquote>
+ </td></tr>
+ </table>
+ </a>
+ <a name="shell-redirect-1">
+ <table border="0" cellspacing="0" cellpadding="2" width="100%">
+ <tr><td bgcolor="#828DA6">
+ <font color="#ffffff" face="arial,helvetica,sanserif">
+ <strong>
+ How do I include a < character in my command line arguments?
+ </strong>
+ </font>
+ </td></tr>
+ <tr><td>
+ <blockquote>
+ <p>The short answer is "Use
<code>&lt;</code>".</p>
+ <p>The long answer is, that this
probably won't do what you
+ want anyway, see <a href="#shell-redirect-2">the next
+ section</a>.</p>
+ </blockquote>
+ </td></tr>
+ </table>
+ </a>
+ <a name="shell-redirect-2">
+ <table border="0" cellspacing="0" cellpadding="2" width="100%">
+ <tr><td bgcolor="#828DA6">
+ <font color="#ffffff" face="arial,helvetica,sanserif">
+ <strong>
+ How do I redirect standard input or standard output
+ in the <code><exec></code> task?
+ </strong>
+ </font>
+ </td></tr>
+ <tr><td>
+ <blockquote>
+ <p>Say you want to redirect the standard input
stream of the
+ <code>cat</code> command to read from a file, something
+ like</p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+shell-prompt> cat < foo
+</pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>and try to translate it into</p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+<exec executable="cat">
+ <arg value="&lt;" />
+ <arg value="foo" />
+</exec>
+</pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>This will not do what you expect.
The input-redirection is
+ performed by your shell, not the command itself, so this
+ should read:</p>
+ <div align="left">
+ <table cellspacing="4" cellpadding="0" border="0">
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#ffffff"><pre>
+<exec executable="/bin/sh">
+ <arg value="-c" />
+ <arg value="cat &lt; foo" />
+</exec>
+</pre></td>
+ <td bgcolor="#023264" width="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ </tr>
+ <tr>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ <td bgcolor="#023264" height="1"><img src="/images/void.gif"
width="1" height="1" vspace="0" hspace="0" border="0"/></td>
+ <td bgcolor="#023264" width="1" height="1"><img
src="/images/void.gif" width="1" height="1" vspace="0" hspace="0"
border="0"/></td>
+ </tr>
+ </table>
+ </div>
+ <p>Note, that you must use the
<code>value</code> attribute of
+ <code><arg></code> in the last element.</p>
</blockquote>
</td></tr>
</table>
1.10 +50 -0 jakarta-ant/webpage/xdocs/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/webpage/xdocs/faq.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- faq.xml 2001/07/13 08:56:32 1.9
+++ faq.xml 2001/07/25 07:58:32 1.10
@@ -196,6 +196,56 @@
</answer>
</faq>
+
+ <faq id="shell-redirect-1">
+ <question>How do I include a < character in my command line
arguments?</question>
+ <answer>
+ <p>The short answer is "Use <code>&lt;</code>".</p>
+
+ <p>The long answer is, that this probably won't do what you
+ want anyway, see <a href="#shell-redirect-2">the next
+ section</a>.</p>
+ </answer>
+ </faq>
+
+ <faq id="shell-redirect-2">
+ <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
+ like</p>
+
+ <source><![CDATA[
+shell-prompt> cat < foo
+]]></source>
+
+ <p>and try to translate it into</p>
+
+ <source><![CDATA[
+<exec executable="cat">
+ <arg value="<" />
+ <arg value="foo" />
+</exec>
+]]></source>
+
+ <p>This will not do what you expect. The input-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" />
+</exec>
+]]></source>
+
+ <p>Note, that you must use the <code>value</code> attribute of
+ <code><arg></code> in the last element.</p>
+
+ </answer>
+ </faq>
+
</faqsection>
<faqsection title="Ant and IDEs/Editors">