Reset to default
Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.
It falls back to sorting by highest score if no posts are trending.
> id=`mysql -uroot -ppwd -s -N -e "SELECT id FROM nagios.host WHERE name="$host""` > echo $id 0
From the manual:
Silent mode. Produce less output. This option can be given multiple times to produce less and less output. This option results in nontabular output format and escaping of special characters. Escaping may be disabled by using raw mode; see the description for the --raw option.
Do not write column names in results.
-ss works as well and much easier to remember.
Even More Compact:
id=$(mysql -uroot -ppwd -se "SELECT id FROM nagios.host WHERE name=$host"); echo $id;
mysql -B --column-names=0 -uroot -ppwd -e "SELECT id FROM nagios.host WHERE name="$host""
-B will print results using tab as the column separator and
–column-names=0 will disable the headers.
I tried the solutions but always received empty response.
In my case the solution was:
#!/bin/sh FIELDVALUE=$(mysql -ss -N -e "SELECT field FROM db.table where fieldwhere="$2"") echo $FIELDVALUE