小编use*_*12a的帖子

如何在后台运行无限循环

如何在后台运行无限循环,同时继续执行脚本?

示例“脚本”:

while true; do something_in_the_background; done

do_something_while_the_loop_goes_on_in_the_background

for 1 2 3; do somethingelse; done

exit 0
Run Code Online (Sandbox Code Playgroud)

这(注意&)似乎在短时间内使整个系统崩溃:

while true; do
  something_in_the_background &
done

do_something_while_the_loop_goes_on_in_the_background

for 1 2 3; do somethingelse; done

exit 0
Run Code Online (Sandbox Code Playgroud)

bash

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

标签 统计

bash ×1