in reply to using pipes in a system() call
the output is so:#!/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++; }
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.find /home1/castillo -user 1202 -print | xargs -n 1 chown -h 51617 sh: syntax error at line 1: `|' unexpected
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using pipes in a system() call
by sgifford (Prior) on Dec 07, 2005 at 20:58 UTC | |
|
Re^2: using pipes in a system() call
by jfroebe (Parson) on Dec 07, 2005 at 21:03 UTC |