Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mimsy!brillig!israel From: israel@brillig.UUCP Newsgroups: comp.unix.questions Subject: Re: Suppressing the message of the day. Message-ID: <6720@mimsy.UUCP> Date: Sun, 17-May-87 01:25:34 EDT Article-I.D.: mimsy.6720 Posted: Sun May 17 01:25:34 1987 Date-Received: Sun, 17-May-87 09:01:19 EDT References: <15452@brunix.UUCP> <1506@uwmacc.UUCP> <1100@sigi.Colorado.EDU> Sender: news@mimsy.UUCP Reply-To: israel@brillig.UUCP (Bruce Israel) Organization: U of Maryland, Dept. of Computer Science, Lines: 49 In article <1100@sigi.Colorado.EDU> forys@boulder.Colorado.EDU (Jeff Forys) writes: >> In article <15452@brunix.UUCP> kbb@brunix.UUCP (Karl Berry.) wonders: >> > Is it possible to suppress the printing of the message of the day > > If you want "/etc/motd" displayed >only when the contents change, you might use something like: > > cmp -s .hushlogin /etc/motd > if ( $status ) then > cat /etc/motd | tee .hushlogin > endif The problem with this is that first, here at our site we have a crontab daemon that puts a greeting into the motd based on the time of day, changing it every six hours, and second, when someone adds a new couple of lines to the motd, I don't really want to see the parts of it that have been around for the last couple of days. What I did was to write the following shell script, called motdprint, that I call from my .login. What this shell script does is to print whatever's been added to the motd. You'll also see an 'egrep -v' that removes the spurious greeting line. Enjoy. #! /bin/csh -f # # motdprint - print the changed versions of the MOTD # - BNI 8/18/86 # # This script prints /etc/motd if it has been changed since the last # time it was printed. If it was changed, it will only print out any # new lines, i.e. lines that were added only, not any lines that it # would've printed out previously. # cd touch .hushlogin egrep -v 'Good morning\!|Good afternoon\!|Good evening\!|What are you doing on at this time of night?' /tmp/motd.$$ cmp -s /tmp/motd.$$ .hushlogin if (${status} != 0) then diff .hushlogin /tmp/motd.$$ | grep '^>' | sed -e 's/^>//' cp /tmp/motd.$$ .hushlogin endif rm -f /tmp/motd.$$ -- Bruce Israel University of Maryland, Computer Science Dept. seismo!mimsy!israel (Usenet) israel@mimsy.umd.edu (Internet)