#!/bin/sh

#Ike's first real shell script, although it is very very small. It
#will finger at all the machines listed in
#/afs/sipb.mit.edu/admin/office/office-heads
#(all the heads in the SIPB office)

thefile=/afs/sipb.mit.edu/admin/office/office-heads

#  the pattern we give grep matches every line that doesn't start with
#  a "#" or a "-"; based on the structure of the office-heads file,
#  this grep will return all of the 'fingerable' heads.

PATH=$PATH:`athdir sipb`

for head in `(grep "^[^#-]" $thefile)`

do

# finger doesn't support timeout, so use nc. --geofft, 2/2009
echo "[$head.mit.edu]"
echo | nc -w1 "$head.mit.edu" finger

done
