繁体   English   中英

如何在bash中同时运行多个命令,而不是一个接一个地运行?

[英]How to run multiple commands at the same time in bash instead of running one after another?

我需要在bash中运行多个命令,而不必等到完成第一个命令并启动其他命令。 这些命令在bash文件中可以像这样。

#!/bin/bash
perl test.pl -i file1 -o out1
perl test.pl -i file2 -o out2
and so on

所有这些都应该在不同的内核中同时运行,而不是一个接一个地运行。

&背景:

#!/bin/bash
perl test.pl -i file1 -o out1 &
perl test.pl -i file2 -o out2 &

或者更好的是,使用GNU parallel 这将允许您使用多个CPU以及更多。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM