Linux News User wrote:
Does any one have a script to send an email to all the users on a server ?
Why do I *always* forget to actually attach attachments!!! Grrr. Here it is, sorry, Chris -- __ _ -o)/ / (_)__ __ ____ __ Chris Reeves /\\ /__/ / _ \/ // /\ \/ / ICQ# 22219005 _\_v __/_/_//_/\_,_/ /_/\_\ #!/usr/bin/perl # This variable holds the name (and path) of the file you want to output to. $listfile = "userlist"; # I ran the program on a copy of the password file for safety. There shouldn't # be any problems running it on the actual password file. If you want to run # it on the actual password file, uncomment the following line and comment the # line following it. #open (PASSWD,"/etc/passwd"); open (PASSWD,"passwd"); open (USERLIST,">$listfile"); foreach $line (<PASSWD>) { # This if statement throws away any comments and blank lines it finds in the # /etc/passwd file. if (($line =~ /^#/) || ($line =~ /^\s$/)) { next; } # Throw away everything after the first colon. $line =~ s/:.*//; print USERLIST $line; } close (PASSWD); close (USERLIST); -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq