-
Notifications
You must be signed in to change notification settings - Fork 1
/
hands-xbiff
47 lines (37 loc) · 1.28 KB
/
hands-xbiff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
> There is no reason to use another program or modify xbiff. It already has
> the hooks you need.
>
> In /usr/lib/X11/app-defaults/XBiff:
>
> *checkCommand:/usr/local/bin/checkmail
>
> In /usr/local/bin/checkmail:
Here's a slightly improved version of checkmail
(fewer forks, less space used by .prevmail etc.):
----<cut here>----
#!/bin/sh
# Copyright (c) 1998 Software in the Public Interest <http://www.debian.org>
# written by Philip Hands <[email protected]> (2 April 1998), inspired by a
# script by Timothy L. Mayo <[email protected]>, distributed under the GPL
EMPTY="d41d8cd98f00b204e9800998ecf8427e"
SUM="md5sum"
# if you don't have md5sum, use something like these two lines instead
# EMPTY="00000 0"
# SUM="sum -r"
MAILSUM="`ls $HOME/Maildir/new | $SUM`"
# if "new" is empty, remove the debris, and exit
if [ "$MAILSUM" = "$EMPTY" ]; then
test -f $HOME/.prevmail && rm $HOME/.prevmail
exit 2
fi
# check if the sums are unchanged
if [ -f $HOME/.prevmail ] && [ "$MAILSUM" = "`cat $HOME/.prevmail`" ]; then
exit 1
fi
# otherwise new mail has arrived
echo -n $MAILSUM > $HOME/.prevmail
exit 0
# End of Script
----<cut here>----
I know it's a bit sad optimising shell scripts, but I'm going to include this
in my Debian qmail-src package, so I thought I'd fix it a little.