home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / utils / elm / messages.cmd < prev    next >
OS/2 REXX Batch file  |  1992-03-21  |  602b  |  36 lines

  1. extproc sh
  2.  
  3. : Use /bin/sh
  4. # messages: part of the Elm mail system
  5. # @(#)$Id: messages,v 4.1 90/04/28 22:44:45 syd Exp $
  6.  
  7. if [ "$2" != "" ]; then
  8.   echo ""
  9.   echo Usage: messages \{folder-name\} 1>&2
  10.   exit 1
  11. fi
  12.  
  13. if [ "$1" = "" ]; then
  14.   fname=d:/uupc/mail/$LOGNAME
  15.   optional="in your mailbox"
  16. else
  17.   fname=$1
  18.   optional="in folder $1"
  19. fi
  20.  
  21. if [ -f "$fname" ]; then
  22.   mcount=`egrep -c "^From " $fname`
  23. else
  24.   exit 0
  25. fi
  26.  
  27. echo ""
  28.  
  29. if [ "$mcount" -eq 1 ]; then
  30.   echo There is $mcount message $optional.
  31. else
  32.   echo There are $mcount messages $optional.
  33. fi
  34.  
  35. exit $mcount
  36.