home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl -- # -*-Perl-*-
-
- $me = "franklin";
- $logfile = "/users/students/franklin/.fingerees";
- $pscommand = "ps -auw";
-
- open(PS, "$pscommand |");
- @fingers = grep(/(f\s+$me)|(finger\s+$me)/, <PS>);
- close(PS);
-
- ($num) = unpack("A9", `wc -l $logfile`); # =~ s/^\s*(\d+).*\n/\1/;
- ($num2) = $num/2;
- printf "I have been fingered %d time", $num2;
- print "s" if ($num - 1);
- print " today\n";
- close(STDOUT);
-
- open(LOG, ">>$logfile");
- foreach $line (@fingers) {
- ($user) = $line =~ /^\s*(\S+)/;
- print LOG "$user, at ", `date`;
- }
-
- print(LOG "somebody, at ", `date`) if (! ($#fingers + 1));
- close(LOG);
-