The stupid question is the question not asked | |
PerlMonks |
Re^2: best practices for checking system return values for piped commands?by eXile (Priest) |
on May 02, 2006 at 02:41 UTC ( [id://546801]=note: print w/replies, xml ) | Need Help?? |
I second the use of bash-es PIPESTATUS, I've used it in code like this:
my %cmds = ( 'bash' => '/usr/local/bin/bash', 'gzip' => '/usr/bin/gzip', 'lzop' => '/usr/bin/lzop', 'wc' => '/usr/bin/wc' ); my @zip_results = `$cmds{'bash'} -c '$cmds{$compress} -dc $file | $cmds{'wc'} -c ; echo \${PIPESTATUS\@}'`;The last line of @zip_results has the status of both the 'compress' command and the 'wc' command.
In Section
Seekers of Perl Wisdom
|
|