One UNIX system I worked on had a really lonnnnnnnng login message that scrolled across my screen. It had a lot of old stuff that I'd seen for the last three weeks. For a while, I started ignoring it. But I knew that some day the system manager would put a shutdown notice in there that I wouldn't see...
This script solved the problem. I run it from my .login file. Each time I log in, the script compares the current /etc/motd file to the one on my previous login. If lines were added, I see them; the script pauses to give me time to read:
If there are no new lines, my login is nice and quiet.
to compare the system's current motd
to the motd
at your last
login on that host (stored in a file named .last.motd.
diff $lastmotd /etc/motd > $temp ... if grep "^>" $temp >/dev/null # diff USES > TO MARK NEW LINES then ...show lines...
The command also shows lines that have been added to a file. But comm only handles sorted files; this trick works on unsorted files. The tests grep 's (grep returns a zero status when it finds matching lines). grep 's output is "thrown away" into - some versions of grep have a -s ("silent") option to do the same thing.
This script is designed to work on networked filesystems where my same home directory is mounted on more than one computer. If your home directory isn't shared between computers, or if all systems have the same system messages, you can edit the script to delete the hostname variable and command.