ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/xdocs faq.xml
Date Thu, 14 Aug 2003 16:16:21 GMT
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>&lt;exec&gt;</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&gt; cat &lt; foo
  +shell-prompt&gt; m4 foo.m4 &gt; foo
   </pre>
                           <p>and try to translate it into</p>
                           <pre class="code">
  -&lt;exec executable=&quot;cat&quot;&gt;
  -  &lt;arg value=&quot;&amp;lt;&quot; /&gt;
  -  &lt;arg value=&quot;foo&quot; /&gt;
  +&lt;exec executable=&quot;m4&quot;&gt;
  +  &lt;arg value=&quot;foo.m4&quot;/&gt;
  +  &lt;arg value=&quot;&amp;gt;&quot;/&gt;
  +  &lt;arg value=&quot;foo&quot;/&gt;
   &lt;/exec&gt;
   </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">
   &lt;exec executable=&quot;/bin/sh&quot;&gt;
     &lt;arg value=&quot;-c&quot; /&gt;
  -  &lt;arg value=&quot;cat &amp;lt; foo&quot; /&gt;
  +  &lt;arg value=&quot;m4 foo.m4 &amp;gt; foo&quot; /&gt;
   &lt;/exec&gt;
   </pre>
                           <p>Note that you must use the <code>value</code>
attribute of
  @@ -701,7 +702,7 @@
           you can use:</p>
                           <pre class="code">
   &lt;exec executable=&quot;/bin/sh&quot;&gt;
  -  &lt;arg line='-c &quot;cat &amp;lt; foo&quot;'/&gt;
  +  &lt;arg line='-c &quot;m4 foo.m4 &amp;gt; foo&quot;'/&gt;
   &lt;/exec&gt;
   </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>&lt;exec&gt;</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="&lt;" />
  -  <arg value="foo" />
  +<exec executable="m4">
  +  <arg value="foo.m4"/>
  +  <arg value="&gt;"/>
  +  <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 &lt; foo" />
  +  <arg value="m4 foo.m4 &gt; foo" />
   </exec>
   ]]></source>
   
  @@ -347,7 +348,7 @@
           you can use:</p>
           <source><![CDATA[
   <exec executable="/bin/sh">
  -  <arg line='-c "cat &lt; foo"'/>
  +  <arg line='-c "m4 foo.m4 &gt; foo"'/>
   </exec>
   ]]></source>
   
  
  
  

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


Mime
View raw message