title: How to fetch field from MySQL query result in bash
body: <p>I would like to get only the value of a MySQL query result in a bash script. For example the running the following command:</p>
  
  <pre><code>mysql -uroot -ppwd -e "SELECT id FROM nagios.host WHERE name='$host'"
  </code></pre>
  
  <p>returns:</p>
  
  <pre><code>+----+
  | id |
  +----+
  | 0  |
  +----+
  </code></pre>
  
  <p>How can I fetch the value returned in my bash script?</p>