passwd-to-alias.pl [plain text]
print "# Generated from passwd by $0\n";
$wordpat = '([a-zA-Z]+?[a-zA-Z0-9-]*)?[a-zA-Z0-9]'; while (@a = getpwent) {
($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
($fullname = $gcos) =~ s/,.*$//;
if (!-d $dir || !-x $shell || $shell =~ m!/bin/(false|true)$!) {
print "$name: root\n"; }
$fullname =~ s/\.*[ _]+\.*/./g;
$fullname =~ tr [εδιφόΕΔΦά] [aaeouAAOU]; next if (!$fullname || lc($fullname) eq $name); if ($fullname =~ /^$wordpat(\.$wordpat)*$/o) { print "$fullname: $name\n";
} else {
print "# $fullname: $name\n"; }
};
endpwent;