Training scripts

Matej Cepl cepl at surfbest.net
Tue Jan 27 23:33:06 CET 2004


On Tuesday 27 of January 2004 11:20, Clint Adams wrote:
> What you are doing here is trying to redirect the contents of 
> the file
> '{}' to find, and send the output of find to $HOME/spam.  
Unless your
> copy of find is capable of redirecting file descriptors or 
automatically
> passes -exec clauses to a command interpreter, you'd have to do 
something
> like fork a shell for every single formail exec.

Thanks, that's it! Finally, I was able to create this script 
which happily collects messages for training from live folders 
(and yes, it is probably the wildest bash script I created so far 
:-):

   #!/bin/sh
   # $Id: bogocorpus,v 1.2 2004/01/27 19:52:03 matej Exp matej $

   find $HOME/Maildir/ $HOME/.mail/ -type f -name 10\* \
       \! -iregex $HOME/.\*/_junk.\* \
       \! -name \*T \
       -exec echo '{}' \; \
       -exec sh -c "formail -I X-Bogosity: -I X-KMail \
         -ds < {} >> $HOME/ham" \;

   find $HOME/.mail/_junk -type f -name 10\* \
       -exec echo '{}' \; \
       -exec sh -c "formail -I X-Bogosity: -I X-KMail \
         -ds < {} >> $HOME/spam" \;

However, when trying to apply same tricks to the other script 
(for retraining bogofilter on errors -- this is actually the 
script which I use every day). When trying this testing script, 
I am still not able to pull it off:

   #!/bin/bash

   MAILDIR=$HOME/.mail

   find $MAILDIR/_junk/ -type f -name 10\* \
       -exec sh -c "export STR=`basename '{}'`" \; \
       -exec echo $STR \; 

The script prints only 143 empty lines. What am I doing 
incorrectly?

Thanks a lot,

   Matej

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
This is a test of the emergency signature system. Were this an
actual signature, you would see amusing mottos, disclaimers,
a zillion net addresses, or edifying philosophical statements.
This is only test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
URL: <http://www.bogofilter.org/pipermail/bogofilter/attachments/20040127/34f770f7/attachment.sig>


More information about the Bogofilter mailing list