title: execute mysql query in shell script
body: <p>Suppose i have 2 databases nm and nm_history. I need to get records from both databases.if i execute query in mysql, its working fine. But if i execute that query in bin/bash it returns following error</p>
  
  <p>**</p>
  
  <pre><code>mysql: option '-e' requires an argument
  ./get_rec.sh: line 4: subscriber_2: command not found
  ./get_rec.sh: line 4: a_party: command not found
  ./get_rec.sh: line 4: subscriber_2: command not found
  ./get_rec.sh: line 4: prov_channel: command not found
  ./get_rec.sh: line 4: subscriber_2: command not found
  ./get_rec.sh: line 4: created: command not found
  ./get_rec.sh: line 4: svc_mgmt_07: command not found
  ./get_rec.sh: line 4: created: command not found
  ./get_rec.sh: line 4: subscriber_2: command not found
  ./get_rec.sh: line 4: svc_mgmt_07: command not found
  ./get_rec.sh: line 4: subscriber_2: command not found
  ./get_rec.sh: line 4: a_party: command not found
  ./get_rec.sh: line 4: svc_mgmt_07: command not found
  ./get_rec.sh: line 4: msisdn: command not found
  ./get_rec.sh: line 4: svc_mgmt_07: command not found
  ./get_rec.sh: line 4: action_type: command not found
  ./get_rec.sh: line 4: SELECT nm.., nm.., nm.. AS Created, nm_history.. AS terminate FROM nm. INNER JOIN nm_history.  ON nm.. = nm_history..
  WHERE nm_history..=2: command not found
  </code></pre>
  
  <p>**</p>
  
  <p>here is the script: </p>
  
  <pre><code>mysql -uUser -pPassword -hHostDB -e
  </code></pre>
  
  <p>The query:</p>
  
  <pre><code>SELECT S.`a_party`, S.`prov_channel`, S.`created` AS Created,M.`created` AS terminate FROM nm.`subscriber_1` S INNER JOIN nm_history.`svc_mgmt_06` M ON S.`a_party` = M.`msisdn` 
  WHERE M.`action_type`=2;**
  </code></pre>