title: MYSQL: How to check exit status?
body: <p>I've a problem with mysql remote connections. One server located in USA, the other located in Netherlands and the connection between them is horrible, especially in the evenings.</p>
  
  <p>I managed to solve the <code>select</code> query by setting a timeout</p>
  
  <pre><code>done &lt; &lt;(mysql --connect_timeout=10 --batch -e "${selectQ}" -u${user} -p${password} ${database} -h ${host})
  </code></pre>
  
  <p>but I don't know how to solve <code>update</code> query, as it should be send only once.</p>
  
  <pre><code>echo "UPDATE table set field='1' WHERE id='${id}'" | mysql -u${user} -p${password} ${database} -h ${host}
  </code></pre>