#!/usr/local/bin/perl -w # too lazy to finger someone at all the machines they might be on? # don't want to type in their exact user id? # then you need lazy-finger! # # /home/mackay/bin/fing.p by David MacKay # usage: # fing.p # fingers all users active on all our machines except for you # fing.p Mat # fingers all users whose name or uid has something like Mat in it. $alwaysprint = 1 ; $verbose = 0 ; $name2 = "" ; eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; $name=0; if(@ARGV) { $name = $ARGV[0] ; print "fingering $name \n" ; } $c = "whoami" ; open (O , "$c |") ; $_ = ; ($who) = split("\n", $_ ) ; print "$_ -> I am $who\n" if $verbose ; # uist rum yell @M = ("tiree","orkney","islay","skye", "jura", "harris", "mull", "eor", "wol", "coll", "arran", "barra" , "uist" ) ; foreach $m ( @M ){ $c = "finger $name2".'@'.$m ; print STDOUT $c, "\n" if $verbose ; open (O , "$c |") ; $printed = 0 ; while() { if(!(/$who/ || /\[/ || /ogin/ || /ogged/ ) ) { if ( !$name || /$name/ ) { if (!$printed || $alwaysprint ) { print "on $m: " ; } print ; $printed ++ ; } } } }