Find all users without passwords? : getgrent « System Functions « Perl






Find all users without passwords?

      

    #!/usr/local/bin/perl -w

    my $count = 1;

    while (($account, $passwd, $uid, $gid, $quota, $comment, $gcos, $home, $shell) = getpwent()){
        if ($passwd eq "" || $passwd eq "*")
        {
            write;
            $count++;
        }
    }
    format STDOUT_TOP=
    Count Account         UID    GID    Home
   
    .

    format STDOUT=
    @>>>> @<<<<<<<<<<<<<< @<<<<< @<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $count,$account,$uid,$gid,$home
   
    .

   
    
    
    
    
    
  








Related examples in the same category

1.Get group name
2.The Perl function getgrent retrieves an item from the user group file.
3.getgrent function