programming-examples/perl/SystemFunction/To display all the -etc-passwd fields for users passed on the command line.pl
2019-11-15 12:59:38 +01:00

16 lines
468 B
Perl

#!/usr/bin/perl -w
foreach $username (@ARGV) {
($name, $passwd, $uid,$gid, $quota, $comment,$gcos, $dir, $shell) = getpwnam($username);
print "name = $name\n";
print "passwd = $passwd\n";
print "uid = $uid\n";
print "gid = $gid\n";
print "quota = $quota\n";
print "comment = $comment\n";
print "gcos = $gcos\n";
print "dir = $dir\n";
print "shell = $shell\n\n";
}