title: Self generating bash script
body: <p>Hi I am trying to create script which will after run copy its content inside another file with different name (time dependent to debugging pruposes) my idea is something like that</p>
  
  <pre><code>#!/bin/bash
  content="printf \"#!/bin/bash\\n%s\" \"$content\" &gt;&gt; \`date +%s+%M\`"
  printf "#!/bin/bash\ncontent=%s\n%s" "$content" "$content" &gt;&gt; `date +%s+%M`
  </code></pre>
  
  <p>This script of course doesn't work because after run it didn't append last line correctly. </p>
  
  <p>As a result I got something like this:</p>
  
  <pre><code>#!/bin/bash
  content=printf \"#!/bin/bash\n%s" "" &gt;&gt; `date +%s+%M`
  printf "#!/bin/bash\n%s" "" &gt;&gt; `date +%s+%M`
  </code></pre>
  
  <p>I had also tried with 'echo' rather than 'printf' but with echo it is even more complicated and because of my weak bash skills I am unable to figure out how to fix it. Also after hour of trying I am unable to discover any way how to fix this.</p>