title: Heredocs, variables and single quotes in BASH and MySQL
body: <p>I'm trying to send some data to a remote MySQL database using a BASH script on GNU/Linux, but get various errors.. Here's the line that's not working:</p>
  
  <pre><code>mysql --host=192.168.0.100 --user=petercapaldi --password=mypassword mystartrekcharacterbase &lt;&lt; EOF
  INSERT into myfourlegs values ('$PERSON','$THETIME','$THETIME','$THEDATE','$DAYOFWEEK');
  EOF
  </code></pre>
  
  <p>and this too (just in case):</p>
  
  <pre><code>mysql --host=192.168.0.100 --user=petercapaldi --password=mypassword mystartrekcharacterbase &lt;&lt; EOF
  INSERT into myfourlegs values (\047$PERSON\047,\047$THETIME\047,\047$THETIME\047,\047$THEDATE\047,\047$DAYOFWEEK\047);
  EOF
  </code></pre>