title: A bash riddle concerning stream redirection: `cat x > y <`
body: <p>I was given a following bash riddle with no additional information on the meaning of variables used.</p>
  
  <pre><code>cat x &gt; y &lt;
  </code></pre>
  
  <p>I assumed x and y are files. In my bash this does not execute though (unexpected newline), so I tried something like this</p>
  
  <pre><code>ls *.txt &gt;0; cat file1.txt &gt; file2.txt &lt;0;
  </code></pre>
  
  <p>To my understanding this should put file1.txt to file2.txt and then the result of <code>ls *.txt</code>. It doesn't. It puts only file1.txt. And it's not the case of being overwritten since the result of the following is the same:</p>
  
  <pre><code>ls *.txt &gt;0; cat file1.txt &gt;&gt; file2.txt &lt;0;
  </code></pre>
  
  <p>My question is:</p>
  
  <ol>
  <li><p>why is redirection of standard input is ignored?</p></li>
  <li><p>why <code>&lt;</code> at the end was incorrect and I had to place <code>&lt;0</code> explicitly? Isn't that zero should be assumed by default?</p></li>
  </ol>
  
  <h2>update</h2>
  
  <p>As pointed out, I've mistaken <code>&gt;0</code> with <code>&gt;&amp;0</code>. The question remains valid though.</p>