in reply to Perl won't run command with "|&"
Perl uses /bin/sh. It would be useless if the syntax of the command had to vary based on what shell a user used on a particular day.
You could always run csh from sh.
use String::ShellQuote qw( shell_quote ); my $cmd = shell_quote('csh', '-c', 'wget http://... |& tee ...'); my $result = `$cmd`;
Or avoid you can use the multi-arg open-pipe syntax to avoid sh and run csh directly.
my $cmd = 'wget http://... |& tee ...'; open(my $pipe, '-|', '/bin/csh', '-c', $cmd) or die $!; my $result; { local $/; $result = <$pipe>; }
Or you can adjust for sh.
my $cmd = 'wget http://... 2>&1 | tee ...'; my $result = `$cmd`;
|
|---|