Legatie
asked on
find and perl
Hello,
I am using find2perl for finding files with no UIDs.
#! /usr/opt/perl5/bin/perl -w
eval 'exec /usr/opt/perl5/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# Set the variable $File::Find::dont_use_nlin k if you're using AFS,
# since AFS cheats.
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
sub wanted;
my (%uid, %user);
while (my ($name, $pw, $uid) = getpwent) {
$uid{$name} = $uid{$uid} = $uid;
}
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, '/');
exit;
sub wanted {
my ($dev,$ino,$mode,$nlink,$u id,$gid);
(
(($dev,$ino,$mode,$nlink,$ uid,$gid) = lstat($_)) &&
($dev >= 0)
||
($dev >= 0)
) &&
!exists $uid{$uid} &&
print("$name\n");
}
Can someone help in fixing the following errors.
Use of uninitialized value in numeric ge (>=) at ./find_owner_script.pl line 35.
Use of uninitialized value in exists at ./find_owner_script.pl line 35.
Also I would like to exclude proc from the search.
Thanks.
I am using find2perl for finding files with no UIDs.
#! /usr/opt/perl5/bin/perl -w
eval 'exec /usr/opt/perl5/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# Set the variable $File::Find::dont_use_nlin
# since AFS cheats.
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
sub wanted;
my (%uid, %user);
while (my ($name, $pw, $uid) = getpwent) {
$uid{$name} = $uid{$uid} = $uid;
}
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, '/');
exit;
sub wanted {
my ($dev,$ino,$mode,$nlink,$u
(
(($dev,$ino,$mode,$nlink,$
($dev >= 0)
||
($dev >= 0)
) &&
!exists $uid{$uid} &&
print("$name\n");
}
Can someone help in fixing the following errors.
Use of uninitialized value in numeric ge (>=) at ./find_owner_script.pl line 35.
Use of uninitialized value in exists at ./find_owner_script.pl line 35.
Also I would like to exclude proc from the search.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.