2.14 motd.diff: Show New Lines in Login MessagesOne 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:
login: If there are no new lines, my login is nice and quiet.
motd.diff
uses
diff
(
28.1
)
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
comm
(
28.12
)
command also shows lines that have been added to a file. But
comm
only handles sorted files; this trick works on unsorted
files. The
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. - |
|