如何在Perl的system()
命令中使用bash
語法?如何在Perl的系統()中使用bash語法?
我有一個特定於bash的命令,例如,下面,使用bash的進程替換:
diff <(ls -l) <(ls -al)
我想從Perl中調用它,使用
system("diff <(ls -l) <(ls -al)")
,但它給了我一個錯誤,因爲它使用sh
代替bash
執行命令:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `sort <(ls)'
+1使用列表變種 – 2009-02-20 21:57:20
這也可以防止你調用/ bin/sh只是運行bash – cjm 2009-02-20 21:58:03