or, if you need arguments to your scriptrecurse.pl /complete/path/to/other/script.pl dirname
might work (amazing that I haven't tested that).recurse.pl "/complete/path/to/other/script.pl -blah" dirname
#!/usr/bin/perl #this needs some comments... chdir $ARGV[1]; @ls_retval = `ls -l`; shift ( @ls_retval ); foreach $line (@ls_retval) { @items = split( /\s+/, $line ); $first_char = substr( $items[0], 0, 1 ); if ( $first_char eq 'd' ) { print "directory: $items[8]\n"; print `$0 $ARGV[0] $items[8]`; } elsif ( $first_char eq 'l' ) { print "link: $items[8]\n"; print `$0 $ARGV[0] $items[8]`; } elsif ( $first_char eq '-' ) { print "file: $items[8]\n"; $action_retval = `$ARGV[0] $items[8]`; if ( $action_retval != 0 ) { print "Error $action_retval in $items[8]\n"; } else { print "OK $action_retval for $items[8]\n"; } } } print "Finished\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recursively run another script
by Aristotle (Chancellor) on Aug 08, 2003 at 00:54 UTC | |
by bean (Monk) on Aug 08, 2003 at 06:14 UTC | |
by Aristotle (Chancellor) on Aug 08, 2003 at 12:04 UTC | |
by sweetblood (Prior) on Aug 08, 2003 at 15:05 UTC |