719016
719016

Reputation: 10451

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?

Upvotes: 2

Views: 57

Answers (1)

Andreas Louv
Andreas Louv

Reputation: 47127

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

Upvotes: 5

Related Questions