如何在Perl的system()中使用shell的进程替换?

时间:2009-08-14 07:49:00

标签: linux perl unix

为什么这行Perl会中断?

system("paste <\( cut -f2 $file \) $file2 > $fileout");

这样做的正确方法是什么?

1 个答案:

答案 0 :(得分:4)

这通常是因为Perl使用sh而不是bash来执行系统命令。快速回答是在命令开头包含 bash -c 。这里有一个更好的答案:

How can I use bash syntax in Perl's system()?