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