Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ptsfa!ihnp4!laidbak!mdb From: mdb@laidbak.UUCP (Mark Brukhartz) Newsgroups: comp.unix.wizards Subject: Re: .hushlogin Message-ID: <1066@laidbak.UUCP> Date: Sun, 17-May-87 02:13:21 EDT Article-I.D.: laidbak.1066 Posted: Sun May 17 02:13:21 1987 Date-Received: Sun, 17-May-87 11:49:16 EDT References: <7400@brl-adm.ARPA> Organization: Lachman Associates, Inc., Naperville, IL Lines: 36 Summary: How to print only changes to motd. In article <7400@brl-adm.ARPA>, MARSELLE%gmr.com@RELAY.CS.NET writes: > The other day I read someone's suggestion to use a "make -f .hushlogin" > in the .login file to only print out /etc/motd when its last mod time > changes. Since no further advice regarding what .hushlogin should look > like was provided, [ ... ]. Try the following in your csh ".login" (removing the brackets) or or your sh ".profile" (entirely removing the bracketed items): [set] HOST=`hostname` echo "target: ${HOME}/.motd/${HOST} [\] ${HOME}/.motd/${HOST}: /etc/motd [\] @-if [ -f ${HOME}/.motd/${HOST} ]; \\ then \\ diff ${HOME}/.motd/${HOST} /etc/motd || true; \\ else \\ cat /etc/motd; \\ fi [\] @cp /etc/motd ${HOME}/.motd/${HOST}" | make -f - It generates a "makefile" on the fly in order to use absolute paths without hard-coding the home directory name. This works around make's problems with names which begin with dots. It uses an indirect target to avoid "... is up to date" messages. The "true" command provides a zero exit value in case the diff does not (... it exits nonzero when the input files are different). To see the entire motd when there are any differences, replace the "diff ... || true" with "cat /etc/motd". Finally, the ${HOST} stuff prevents confusion when one login directory is used from several machines (via NFS or the like). I've been using a very similar script for several months. This one is merely jazzed up a bit for near-compatibility between csh and sh. Mark Brukhartz Lachman Associates, Inc. ..!{ihnp4, sun}!laidbak!mdb