Forcing actions at login

Tom Fitzgerald fitz at wang.com
Tue Jan 15 13:20:44 AEST 1991


allbery at NCoast.ORG (Brandon S. Allbery KB8JRR) writes:
> $ sed -n 6,10p /etc/profile
> if test ! -f $HOME/.hushlogin; then
>     if newer-than /etc/motd $HOME/.enoughalready; then
> 	cat /etc/motd
> 	touch $HOME/.enoughalready
>     fi
> fi
> $ cat newer-than.c
> #include <stdio.h>
> #include <sys/types.h>
[...]

Why write C code?  I think this is portable (though, admittedly, ugly):

if test ! -f $HOME/.hushlogin; then
    /bin/find /etc/motd -newer $HOME/.enoughalready -exec cat {} \; 2>/dev/null
    touch $HOME/.enoughalready
fi

---
Tom Fitzgerald   Wang Labs        fitz at wang.com
1-508-967-5278   Lowell MA, USA   ...!uunet!wang!fitz



More information about the Comp.unix.admin mailing list