Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!mephisto!mcnc!rti!xyzzy!brennan From: brennan@rtp.dg.com (Dave Brennan) Newsgroups: comp.mail.elm Subject: mailbox summary script Message-ID: Date: 9 Apr 90 16:08:58 GMT Sender: usenet@xyzzy.UUCP Organization: Data General, RTP, NC Lines: 76 Here's a script I wrote that users around here have found useful. I hope the people reading this group will find it useful as well. This script prints information about the message in your mailbox. For example: % ckmail Mailbox brennan: 2 new, 6 unseen, 35 old messages. # ckmail Mailbox root: empty. There's probably a faster way to do this, but I just wanted to get it to work with as little effort as possible. Enjoy! #!/bin/csh -f # # ckmail - by Dave Brennan (brennan@rtp.dg.com) # # This is a shell script to indicate to the user his mailbox status. # It assumes that the user uses elm as a mailer. # # This will be fouled up if either "From " or "Status: " appear at the # beginning of a non-header line. # if ("$MAIL" == "") then echo "Sorry. $MAIL not defined." exit endif # count the total number of messages: set total = `grep "^From " $MAIL | wc | cut -c5-7` # count the number seen by elm: set seen = `grep "^Status: " $MAIL | wc | cut -c5-7` # count the number read: set read = `grep "^Status: R" $MAIL | wc | cut -c5-7` # count the number unseen by the user set unseen = `grep "^Status: O" $MAIL | wc | cut -c5-7` # so new messages = @ new = $total - $seen # build display strings set c1 = "" set c2 = "" if ( $new != 0 ) then set new = "$new new" set c1 = ", " else set new = "" endif if ( $unseen != 0 ) then set unseen = "$unseen unseen" set c2 = ", " else set unseen = "" endif if ( $read != 0 ) then set read = " $read old" else set read = "" if ( "$c2" == ", " ) then set c2 = "" else set c1 = "" endif endif # stupid, stupid csh... set mail = $MAIL set mbox = $mail:t # here's the deal: if ( $total != 0 ) then echo Mailbox $mbox':' $new$c1$unseen$c2$read messages. else echo Mailbox $mbox':' empty. endif -- _________ Dave Brennan, User Interfaces, Data General Corp. / brennan@dg-rtp.dg.com Research Triangle Park, North Carolina, 27709 / ...mcnc!rti!dg-rtp!brennan Hm: (919) 460-5725 Wk: (919) 248-6330 _________/ dave_brennan@rpitsmts.bitnet