如何在Perl中执行多个(〜15)的bash命令? [英] How to execute many (~15) bash commands in Perl?
问题描述
我知道的系统()
和 QX()
,但我需要执行〜15的bash命令。例如。
I know of system()
and qx()
, but I need to execute ~15 bash commands. E.g.
的mkdir
, CHOWN
, edquota命令-p -u user1的用户2
, CP -r
,苏 - 用户名
,混帐
, RM
, LN -S
问
有没有在Perl执行许多猛砸命令的有效方式?
Is there an efficient way to execute many Bash commands in Perl?
我不在这种情况下对输出无所谓了。
I don't care in this case about the output.
推荐答案
首先,我会使用尽可能多的bash命令,因为我可以在相当于Perl的功能,这是最让你在您的文章包含的那些的。然后,他们其余的人我倒是要么使用system()或QX()或反引号或IPC ::模块(如IPC ::运行或IPC :: Open3)。
First, I'd use the equivalent Perl function for as many of those bash command as I could, which is most of the ones you included in your post. Then, for the rest of them I'd either use system() or qx() or backticks or one of the IPC:: modules (such as IPC::Run or IPC::Open3).
这篇关于如何在Perl中执行多个(〜15)的bash命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!