: ########################################################################## # Shellscript: hfinger - show if sombody 'finger'ed you # Version : 0.1 (beta) # Project : # Author : Heiner Steven (heiner.steven@odn.de) # Written : 30.08.94 # Category : System Administration # SCCS-Id. : $Id: hfinger,v 1.1.1.1 1999/06/15 19:29:05 heiner Exp $ ########################################################################## # Description # ########################################################################## PN=`basename $0` # program name VER='0.1 (beta)' # Determine mail program knowing "-s" argument Mail=mail [ -x /bin/mailx ] && Mail=mailx Usage () { echo "$PN - show when somebody 'finger's you, $VER (stv '94)" exit 1 } Fatal () { for i do echo "$PN: $i" >&2 done exit 1 } : ${LOGNAME:=`who am i | cut -d' ' -f1`} # receiver of mail : ${FINGERMSG:=$HOME/TODO} # file to print : ${FINGERLOG:=$HOME/lib/finger.log} # log file Pipe=${TMPDIR:=/tmp}/info # innocent name... Plan=$HOME/.plan [ $# -gt 0 -a "$1" = "-h" ] && Usage [ -r $FINGERMSG ] || Fatal "file $FINGERMSG not found" trap "rm -f $Pipe $Plan; [ -f $Plan.alt ] && mv $Plan.alt $Plan" 0 trap "exit 1" 1 2 3 15 [ -f "$Plan" ] && mv "$Plan" "$Plan".alt mknod $Pipe p || Fatal "cannot create named pipe" chmod 744 $Pipe || Fatal "cannot change mode of named pipe" ln -s $Pipe $Plan || Fatal "cannot create symbolic link" while : do # cp blocks on write to the named pipe until sombody # reads the pipe (i.e. with "finger") cp $FINGERMSG $Plan # somebody read the file .plan: $Mail -s "$PN" $LOGNAME <> $FINGERLOG sleep 2 done exit 0 # never reached