in reply to printing out users without home directories
What does "user" mean? do system accounts qualify? The following tests all entries from getent passwd
see http://www.linfo.org/etc_passwd.html for the layout of the password file.use strict; use warnings; my @passwd_entries; open (USERS, '-|' , 'getent passwd' ) or die $!; @passwd_entries = <USERS>; close USERS; for my $line (@passwd_entries){ my @parts=split(':',$line); unless ($parts[5]){print $parts[0].' '."No home listed\n";} else { unless (-d $parts[5]) {print $parts[0].' '."dir ".$parts[5]." no +t found\n";} } }
|
|---|