passwd-to-alias.pl
上传用户:xu_441
上传日期:2007-01-04
资源大小:1640k
文件大小:1k
源码类别:

Email客户端

开发平台:

Unix_Linux

  1. #!/bin/perl
  2. #
  3. #  Convert GECOS information in password files to alias syntax.
  4. #
  5. #  Contributed by Kari E. Hurtta <Kari.Hurtta@ozone.fmi.fi>
  6. #
  7. print "# Generated from passwd by $0n";
  8. while (@a = getpwent) {
  9.     ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
  10.     ($fullname = $gcos) =~ s/,.*$//;
  11.     if (!-d $dir || !-x $shell) {
  12. print "$name: rootn";
  13.     }
  14.     $fullname =~ s/.*[ _]+.*/./g;
  15.     $fullname =~ tr [邃雠闹閉 [aaoAAOe];  # <hakan@af.lu.se> 1997-06-15
  16.     if ($fullname =~ /^[a-zA-Z][a-zA-Z-]+(.[a-zA-Z][a-zA-Z-]+)+$/) {  
  17. #   if ($fullname =~ /^[a-zA-Z]+(.[a-zA-Z]+)+$/) {    # Kari E. Hurtta
  18. print "$fullname: $namen";
  19.     } else {
  20. print "# $fullname: $namen";
  21.     }
  22. };
  23. endpwent;