title: cat to combine heredoc and file
body: <p>I'm trying to and failing to understand why this doesn't work. I'm trying to use <code>cat</code> to combine an existing file and a heredoc into one file:</p>
  <pre><code># test.txt
  Hi there
  </code></pre>
  <pre><code>$ cat test.txt &lt;&lt;END &gt; /tmp/combined.txt
  This is heredoc
  END
  </code></pre>
  <p>I would have expected this to function in essence like:</p>
  <pre><code>cat file.txt file1.txt &gt; /tmp/combined.txt
  </code></pre>
  <p>But what I actually see is just the contents of <code>test.txt</code>:</p>
  <pre><code>#/tmp/combined.txt
  Hi there
  </code></pre>
  <p>If I do just the heredoc it works. If i do just the file it works obviously. What is it about combining them that makes cat ignore the heredoc?</p>
  <p>(I know I can use <code>tee</code> and a variety of other approaches to do this but I want to fill in my understanding of cat, redirection etc)</p>