passwd-to-alias.pl
上传用户:xu_441
上传日期:2007-01-04
资源大小:1640k
文件大小:1k
- #!/bin/perl
- #
- # Convert GECOS information in password files to alias syntax.
- #
- # Contributed by Kari E. Hurtta <Kari.Hurtta@ozone.fmi.fi>
- #
- print "# Generated from passwd by $0n";
- while (@a = getpwent) {
- ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
- ($fullname = $gcos) =~ s/,.*$//;
- if (!-d $dir || !-x $shell) {
- print "$name: rootn";
- }
- $fullname =~ s/.*[ _]+.*/./g;
- $fullname =~ tr [邃雠闹閉 [aaoAAOe]; # <hakan@af.lu.se> 1997-06-15
- if ($fullname =~ /^[a-zA-Z][a-zA-Z-]+(.[a-zA-Z][a-zA-Z-]+)+$/) {
- # if ($fullname =~ /^[a-zA-Z]+(.[a-zA-Z]+)+$/) { # Kari E. Hurtta
- print "$fullname: $namen";
- } else {
- print "# $fullname: $namen";
- }
- };
- endpwent;