title: Execute Bash Script within a PDF File
body: <p>I recently discovered that concatenating text to the end of a PDF file does not change properties of the PDF file. This may be a very silly question, but if a program were concatenated to the PDF file, could it somehow be executed?</p>
  
  <p>For example, opening this PDF file would create a text file in the home directory with the words "hello world" in it.</p>
  
  <pre><code>*pdf contents*...
  trailer^M
  &lt;&lt;/Size 219/Root 186 0 R/Info 177 0     R/ID[&lt;5990BFFB4DF3DB26CE6A92829BB5C41B&gt;    &lt;B35E036CA0E7BA4CBF39B3D74DCE4CAF&gt;]/Prev 4494028 &gt;&gt;^M
  startxref^M
  4663747^M
  %%EOF^M
  #!/bin/bash
  echo "hello world" &gt; ~/hello.txt
  </code></pre>
  
  <p>Would this work with a different file format? Does the embedded code need to be a binary executable?</p>