相关疑难解决方法(0)

如何在Perl的system()中使用bash语法?

如何bash在Perl system()命令中使用语法?

我有一个特定于bash的命令,例如以下命令,它使用bash的进程替换:

 diff <(ls -l) <(ls -al)
Run Code Online (Sandbox Code Playgroud)

我想用Perl来调用它

 system("diff <(ls -l) <(ls -al)")
Run Code Online (Sandbox Code Playgroud)

但它给了我一个错误,因为它使用sh而不是bash执行命令:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `sort <(ls)'
Run Code Online (Sandbox Code Playgroud)

bash perl command

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

bash ×1

command ×1

perl ×1