简体   繁体   English

多次异步执行 bash 脚本?

[英]execute bash script asynchronously multiple times?

I have this bash script我有这个 bash 脚本

# a.sh

name="Hello"
echo $name

How can I execute multiple times a.sh asynchronously?如何异步执行多次a.sh

You can use a Bash range expansion and for loop to conveniently express the multiplicity, and the & operator to put the script executions in the background:您可以使用 Bash 范围扩展和for循环来方便地表达多重性,并使用&运算符将脚本执行置于后台:

for x in {1..8}; do
    bash /path/to/a.sh &
done

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

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