#!/bin/sh # messages: part of the Elm mail system # @(#)$Id: messages.SH,v 1.2 1995/06/30 14:56:31 wfp5p Exp $ # Copyright (c) 1988-1992 USENET Community Trust # Copyright (c) 1986,1987 Dave Taylor if [ "$2" != "" ]; then echo Usage: messages \{folder-name\} 1>&2 exit 1 fi if [ "$1" = "" ]; then fname=${MAIL-/var/share/mail/$LOGNAME} optional="in your incoming mailbox" else optional="in folder $1" first=`expr "$1" : "\(.\).*"` if [ "$first" = "=" ]; then last=`expr "$1" : ".\(.*\)"` fname="`grep maildir $HOME/.elm/elmrc | awk -F= '{print $2}'| tr -d ' '`/$last" else fname=$1 fi fi if [ -f "$fname" ]; then mcount=`egrep -c "^From " $fname` else echo "Folder $1 does not exist." exit 0 fi if [ "$mcount" -eq 1 ]; then echo There is 1 message $optional. elif [ "$mcount" -eq 0 ]; then echo There are no messages $optional. else echo There are $mcount messages $optional. fi exit $mcount