Am 22.02.2015 um 15:30 schrieb @lbutlr:
On 21 Feb 2015, at 08:34 , LuKreme <krem...@kreme.com> wrote:
On Feb 18, 2015, at 6:20 AM, Reindl Harald <h.rei...@thelounge.net> wrote:

<bayes-stats.txt>

That is a lot cleaner and more obvious, thank you for sharing

I ran this just after log rotation and got div by zero errors, so here is a 
(nearly) completely pointless ‘fix’:

BAYES_TOTAL=`echo 
"$BAYES_00+$BAYES_05+$BAYES_20+$BAYES_40+$BAYES_50+$BAYES_60+$BAYES_80+$BAYES_95+$BAYES_99"
 | bc`

+ if [ ! $BAYES_TOTAL ]; then
   BAYES_00_PCT=`echo "scale=2; ($BAYES_00*100)/$BAYES_TOTAL" | bc | sed 
's/^\./0./‘`

…

   echo -e "BAYES_999 `printf \"%*s\" 8 $BAYES_999` `printf \"%*s\" 7 
$BAYES_999_PCT` %”
+ fi

Yes, yes, I know, had I run the script a minute later, no error. But if I 
didn’t have OCD tendencies, would I even be on this list? :)

agreed - thanks - but the f don't work here, below a better one

- if [ ! $BAYES_TOTAL ]; then
+ if [ "$BAYES_TOTAL" -gt 0 ]; then

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to