: Use /bin/sh
# messages: part of the Elm mail system
# @(#)$Id: messages,v 4.1 90/04/28 22:44:45 syd Exp $
 
if [ "$2" != "" ]; then
  echo Usage: messages \{folder-name\} 1>&2
  exit 1
fi
 
if [ "$1" = "" ]; then
  fname=$MAIL
  optional="in your mailbox"
else
  fname=$1
  optional="in folder $1"
fi
 
if [ -f "$fname" ]; then
  mcount=`egrep -c "^From " $fname`
else
  exit 0
fi
 
if [ "$mcount" -eq 1 ]; then
  echo There is $mcount message $optional.
else
  echo There are $mcount messages $optional.
fi
 
exit $mcount
