So here is the entire program, this is just a prototype but its just looking through the many home directories we have to find files owned by $UID, and chown's them to the new UID($NEWUID):
#!/usr/local/bin/perl
my $UID = 1202;
my $NEWUID = 51617;
my @home = ( "/home1/", "/home2/", "/home3/", "/home4/", "/home5/",
"/home6/", "/home7/", "/home8/", "/home9/", "/home10/",
"/home11/", "/home12/", "/home13/", "/home14/" );
my $i = 0;
foreach( @home )
{
opendir DH, $home[$i] or die "Cannot open $home[$i]: $!";
foreach $dir ( readdir DH )
{
next if $dir eq "." or $dir eq ".." or $dir eq ".snapshot" or
+$dir eq "TT_DB";
print "find $home[$i]$dir -user $OUN -print | xargs -n 1 chown
+ -h $NEWUID\n";
system("find $home[$i]$dir -user $OUN -print | xargs -n 1 chow
+n -h $NEWUID");
}
$i++;
}
the output is so:
find /home1/castillo -user 1202 -print | xargs -n 1 chown -h 51617
sh: syntax error at line 1: `|' unexpected
So the command I'm giving it prints out exactly as expected, and running that by hand does work. I guess I don't understand why a | is 'unexpected'. I did try `-print \; |` but that doesn't work either.
Thanks to all who replied.
Mike C