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