#!/bin/csh # Version 1.2 # The talk command tends to interrupt people in the middle of a shell # based program (like pine or elm). Talk2 abolishes this and tells the # user if their party is doing something else. # Spots if party is already talking to them. if ( $#argv != 1 ) then echo "Usage: `basename $0` username" exit 1 endif @ pts = `echo $*|grep -c "$user"` if ( $pts != 0 ) then echo "They'll lock you up for that! :)" exit 1 endif @ here = `expr "$1" : ".*@"` if ( $here != 0 ) then # just in case they're not on this server... talk $1 exit 0 endif set pts = ( `\w | grep "$1"` ) if ( $#pts < 2 ) then echo "User $1 is not logged on." exit 1 endif set pts = ( `\w | grep "^$1" | grep "talk" | grep "$user"` ) if ( $#pts < 2 ) set pts = ( `\w | grep "^$1" | grep "sh"` ) set k = ( `\w -s | grep "^$1" | awk '{FS = ""}{print substr ( $1 , 30 ) }'` ) if ( $#pts < 2 ) then echo "User $1 is running $k[1]." exit 1 endif set pts = $pts[2] talk $1 $pts