setgrent |
集合(或重置)組項的設置開始枚舉的。這個函數應該被調用之前第一次調用getgrent。
Nothing
試試下麵的例子:
#!/usr/bin/perl -w #by www.gitbook.net while( ($name,$passwd,$gid,$members) = getgrent() ){ print "Name = $name\n"; print "Password = $passwd\n"; print "GID = $gid\n"; print "Members = $members\n"; } setgrent(); # Set the beginnging of the group database; print "Again reading /etc/passwd file\n"; while( ($name,$passwd,$gid,$members) = getgrent() ){ print "Name = $name\n"; print "Password = $passwd\n"; print "GID = $gid\n"; print "Members = $members\n"; } endpwent; #claose the database; }