As an anonymous monk explained, you can't execute a shell command (of which ">>" is a part) without running a shell!
IPC::Open3 is a somewhat low-level way of doing it, but it's an option.
use IPC::Open3 qw( open3 ); open(local *OUT_FH, '>>', '/Volumes/Expansion Drive/stuffTGZ/list_xxx_ +dirs.txt') or die $!; print(OUT_FH "-------------------------------------------------\n"); print(OUT_FH "- $File::Find::name -----------------------------\n"); # Gets closed by open3. open(local *CHILD_STDIN, '<', '/dev/null') or die $!; my $pid = open3( '<&CHILD_STDIN', '>&OUT_FH', '>&STDERR', "/bin/ls" => ( "-l", $File::Find::name ), ); waitpid($pid, 0);
You can reuse OUT_FH for multiple calls to open3, but you need to reopen CHILD_STDIN each time.
In reply to Re: Another system redirect problem
by ikegami
in thread Another system redirect problem
by trendle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |