title: How to run bash command during redirect << EOF
body: <p>I know there's some way to run bash command during redirect, but I don't know how exactly it is done.</p>
  
  <p>I want to do something like this:</p>
  
  <pre><code>#!/bin/bash
  mysql -uUser -pPasswd &lt;&lt; EOF
  echo 'I wanna echo something by using echo which is run by bash'
  use Mydb
  some sql commands here
  commit;
  EOF
  </code></pre>
  
  <p>I had ever done that by mistake by using " in the "&lt;&lt; EOF" , but failed to make it now.</p>