#! /bin/tcsh source ./nfshosts foreach host ($hosts) echo $host ping $host -c 1 >& /dev/null if ($status == '0') then ssh $host cat $1 | grep $2 else echo " is down" endif end