title: Escaping a dollar sign in Unix inside the cat command
body: <p>On Ubuntu, I would like to end up with a disk file that reads:</p>
  
  <pre><code>foo $(bar)
  </code></pre>
  
  <p>I would like to create this file using the <code>cat</code> command, e.g.</p>
  
  <pre><code>cat &lt;&lt;EOF &gt; baz.txt
  type_magic_incantation_here_that_will_produce_foo_$(bar)
  EOF
  </code></pre>
  
  <p>The problem is the dollar sign.  I have tried multiple combinations of backslash, single-quote, and double-quote characters, and cannot get it to work.</p>