#!/usr/bin/perl # turn on -w for warnings, if need be # Written by Colin Charles # byte@aeon.com.my # Tue Sep 17 03:30:13 EST 2002 # Version 2 last updated Tue Sep 17 13:32:22 EST 2002 # check command line args if need be if (@ARGV!=3) { die "Usage: $0 email \"name\" username\n"; } $USER_EMAIL=$ARGV[0]; $USERS_REAL_NAME=$ARGV[1]; $USERNAME=$ARGV[2]; open WHOAMI, "whoami|" or die "can't do a who am i - check if software is installed\n"; #read filehandle, and store it in a variable while() { chomp($whoami=$_); } #concantetate to get a nice e-mail address $EMAIL_CREATOR=$whoami . "\@yoyo.its.monash.edu.au"; # print $EMAIL_CREATOR; #debug open PASSWD, "/etc/passwd" or die "can't open password file"; while() { ($username,$crypted,$uid,$gid,$name) = split /:/; #format of passwd file if ($username eq $whoami) { #check for equality # print $name; #debug $CREATOR_NAME=$name; } } $YOYO="accounts\@yoyo.its.monash.edu.au"; open MAIL, "|/usr/lib/sendmail -t -f $EMAIL_CREATOR" or die "sendmail couldn't be opened"; print MAIL <