当前位置:首页 » Perl » Perl endpwent()函数

Perl endpwent()函数

perl endpwent()函数,endpwent()函数学习例子,endpwent()函数实例代码,endpwent()函数在线教程等

语法

endpwent


定义和用法

让你的系统不再期望使用getpwent从密码文件中读取条目。 在Windows下,使用的Win32API:: Net函数,从域名服务器得到的信息。

返回值

  • None

例子

试试下面的例子:

#!/usr/bin/perl

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

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";
}

#by www.gitbook.net
endpwent(); # Closes the database;