home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3696 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  1.3 KB

  1. Path: sparky!uunet!mcsun!uknet!warwick!str-ccsun!strath-cs!ex-dcs!exua!cen.ex.ac.uk!WEdmunds
  2. From: WEdmunds@cen.ex.ac.uk (W.Edmunds)
  3. Newsgroups: comp.unix.shell
  4. Subject: comp.unix.shell
  5. Message-ID: <BtJpI1.G1p@cen.ex.ac.uk>
  6. Date: 25 Aug 92 15:25:12 GMT
  7. Organization: University of Exeter
  8. Lines: 21
  9.  
  10. I am trying to print a newsboard from a global cshrc file, so that when a
  11. user logs in he will only receive new messages. The newsboard consists of a 
  12. directory with a number of files, each being a separate article. An entry in
  13. /etc/lastlogs is touched on each login. The problem is that there is no
  14. natural break between news files. I also wish news files to be displayed
  15. in order, with the latest article displayed last. I have written a shell
  16. script that is invoked by the cshrc script, but it is really ugly, in that
  17. it uses "find" to stat the files. Surely, there is an easier way of achieving
  18. this in Bourne shell or c-shell. 
  19.  
  20. Many thanks in advance for any help or pointers, Bill Edmunds.
  21.  
  22. #!/bin/sh
  23. for FILE in `/bin/ls -tr /usr/mail/motds` ; do
  24.         if /bin/find /usr/mail/motds/$FILE -type f -newer /etc/lastlogs/$USER ; then
  25.                 /bin/echo "**************************************************************************\n"
  26.                 /bin/cat /usr/mail/motds/$FILE
  27.                 /bin/echo ""
  28.         fi
  29. done | more
  30. exit
  31.