bogolearn

David Relson relson at osagesoftware.com
Sat Apr 5 21:29:42 CEST 2003


At 02:21 PM 4/5/03, Kevin McKinley wrote:

>I found this "bogolearn" script at O'Reilly. (I changed "GOOD" to "HAM"). I
>offer it here for comment, suggested improvements, or whatever.
>
>Kevin
>
>#!/bin/sh
>
>BOGOFILTER="/usr/bin/bogofilter";
>HAMDIR="/path/to/ham";
>SPAMDIR="/path/to/spam";
>
>cd $SPAMDIR;
>echo Spam:
>for i in *;
>do
>    echo Processing Mail ID \#$i;
>    bogofilter -s -v < $i ;
>done;
>
>cd $HAMDIR;
>echo Ham:
>for i in *;
>do
>    echo Processing Mail ID \#$i;
>    bogofilter -n -v < $i ;
>done;

Two comments:  way too many semicolons; could be simplified as:

#!/bin/sh

BOGOFILTER="/usr/bin/bogofilter";
HAMDIR="/path/to/ham";
SPAMDIR="/path/to/spam";


echo Spam:
for i in $SPAMDIR/*;
do
    echo Processing Mail ID \#$i
    bogofilter -s -v < $i
done

echo Ham:
for i in $HAMDIR/*; do
    echo Processing Mail ID \#$i
    bogofilter -n -v < $i
done

Also, the two lines of output for each message could be combined on a 
single line, i.e.

echo -n $i
bogofilter -s -v < $i





More information about the Bogofilter mailing list