Gentoo Archives: gentoo-server

From: Scott Storck <l0ner@××××××××××.de>
To: gentoo-server@××××××××××××.org
Subject: Re: [gentoo-server] simple shell script
Date: Sun, 03 Apr 2005 00:41:18
Message-Id: 424F3BA0.6080504@twofatguys.de
In Reply to: Re: [gentoo-server] simple shell script by Ben Munat
1 Ben Munat schrieb:
2
3 > Yeah, running sa-learn on an empty directory is fine, but it bugs me
4 > that when I then run rm on the contents of that directory, I get an
5 > error message. I know it doesn't hurt anything... it just bugs me. I
6 > thought it would be trivial to put the calls to "sa-learn" and "rm" in
7 > an if statement, but I guess I was wrong.
8 >
9 No, you are right, it is not hard you just need to know how to do it.
10 Here is part of my login script.
11 It does exactly what you want.
12
13 ------snip--------------
14 #change spamdir to the directoy you want to process
15 spamdir=/home/l0ner/.maildir/.spam
16 if ls -1 $spamdir 1>/dev/null 2>&1
17 then
18 for spamdirfile in `ls -1 $spamdir`
19 do
20 spamfile=$spamdir/$spamdirfile
21 if test -f $spamfile
22 then
23 sa-learn --spam $spamfile
24 rm $spamfile
25 fi
26 done
27 fi
28 ------snip--------------
29
30 BTW, Don't forget to run it over ham too. SA needs to learn both ham and
31 spam for the bayes to function. :^)
32
33 > b
34
35 -l0ner
36
37 --
38 gentoo-server@g.o mailing list

Replies

Subject Author
Re: [gentoo-server] simple shell script Lance Lassetter <lance@×××××××.info>