passwd-to-alias.pl
来自「< linux网络编程工具>>配套源码」· PL 代码 · 共 22 行
PL
22 行
#!/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 $0\n";
$wordpat = '([a-zA-Z]+?[a-zA-Z0-9-]*)?[a-zA-Z0-9]'; # 'DB2'
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"; # handle pseudo user
}
$fullname =~ s/\.*[ _]+\.*/./g;
$fullname =~ tr [邃轹
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?