719016 719016 - 9 months ago 27
Perl Question

perl execute a command where input comes from <(cmd2 input)

I have a Perl script that I run in Linux 64bit and it looks like this:

my $ret = `/my/cmd option1 option2 <(/my/cmd2 input)`

This works in bash, but when I try to execute the same command as a backtick in the Perl script, it complains:

sh: -c: line 0: syntax error near unexpected token `('

Any ideas?


I guess your /bin/sh is not linked to bash, try:

my $ret = `bash -c '/my/cmd option1 option2 <(/my/cmd2 input)'`

You can check what /bin/sh is linked to with:

% ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Apr  5 07:03 /bin/sh -> dash