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 48
|
#! /bin/sh
###############################################################################
#
# $Id: from,v 1.2 1997/12/11 17:42:46 bcwhite Exp $
#
# 'from' for filtered mailboxes
#
# Written by: Behan Webster <behanw@pobox.com>
#
#
# Extract MAILDIR from the procmailrc files...
#
for rcfile in /etc/procmailrc $HOME/.procmailrc; do
if [ -r $rcfile ]; then
eval `sed -n -e 's/#.*$//' -e '/^[A-Z_]*=/p' $rcfile`
fi
done
if [ -z "$MAILDIR" ]; then
echo "$0: MAILDIR is not set" >&2
exit 1;
fi
#
# Go to mail directory
#
cd $MAILDIR
#
# Locate all the mailbox files (may be in sub-directories)
#
mboxlist=`find . \( -name ".??*" -prune \) -o -type f ! -name ".*" -print | sed -e 's|^./||' | sort`
#
# Tell the user what messages are available
#
grep -c "^From " $mboxlist non-existant-mailbox 2>/dev/null | awk -F: '{ if ( $2 > 0 ) printf("%-4d%s\n", $2, $1) }'
#
# We're outta here...
#
exit 0
|