setpwent |
集(或重置)的开头的组的密码条目的枚举。这个函数应该被调用之前在第一次调用getpwent。
Nothing
试试下面的例子:
#!/usr/bin/perl
#by www.gitbook.net
while(($name, $passwd, $uid, $gid, $quota,
$comment, $gcos, $dir, $shell) = getpwent()){
print "Name = $name\n";
print "Password = $passwd\n";
print "UID = $uid\n";
print "GID = $gid\n";
print "Quota = $quota\n";
print "Comment = $comment\n";
print "Gcos = $gcos\n";
print "HOME DIR = $dir\n";
print "Shell = $shell\n";
}
setpwent() ; # Rewind the databse /etc/passwd
#by www.gitbook.net
while(($name, $passwd, $uid, $gid, $quota,
$comment, $gcos, $dir, $shell) = getpwent()){
print "Name = $name\n";
print "Password = $passwd\n";
print "UID = $uid\n";
print "GID = $gid\n";
print "Quota = $quota\n";
print "Comment = $comment\n";
print "Gcos = $gcos\n";
print "HOME DIR = $dir\n";
print "Shell = $shell\n";
}
endpwent(); # Closes the database;