title: how to run sqlite3 in bash script?
body: <p>I'd like to run series of sqlite commands in bash script:</p>
  
  <pre><code>db="main.sqlite3"
  db2="sub.sqlite3"
  
  sqlite3 ${db} &lt;&lt;EOF
  attach ${db2} as m;
  select count(*) from m.details;
  .exit
  EOF
  </code></pre>
  
  <p>when attach to a string, it works, but when it is a variable, it won't, got</p>
  
  <pre><code>Error: near line 1: near "/": syntax error
  </code></pre>
  
  <p>how to use a variable(db2) inside EOF? thanks</p>