|
|
@@ -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 @@ shell-prompt> cat < foo |
|
|
|
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> |
|
|
|