title: How to get number of rows affected, while executing MySQL query from bash?
body: <p>I know how one can execute MySQL queries / commands from bash:</p>
  
  <pre><code>mysql -u[user] -p[pass] -e "[mysql commands]"
  </code></pre>
  
  <p>or </p>
  
  <pre><code>mysql -u[user] -p[pass] `&lt;&lt;`QUERY_INPUT
  
  [mysql commands]
  
  QUERY_INPUT
  </code></pre>
  
  <p>How can I capture how many rows were affected by the query?<br>
  I tried doing:</p>
  
  <pre><code>variable='`mysql -u[user] -p[pass] -e "[mysql commands]"`'
  </code></pre>
  
  <p>It does execute the command but it does not return the number of affected rows.</p>