[英]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.