Linux 在不等待脚本完成执行的情况下从另一个脚本运行 bash 脚本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11183805/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 07:02:05  来源:igfitidea点击:

Run bash script from another script without waiting for script to finish executing?

linuxbashshellprocess

提问by X?pplI'-I0llwlg'I -

Is there any way to execute two bash scripts without the first one blocking? The following does not work:

有没有办法在第一个不阻塞的情况下执行两个 bash 脚本?以下不起作用:

exec ./script1.sh #this blocks!
exec ./script2.sh

采纳答案by OmnipotentEntity

Put &at the end of the line.

放在&行尾。

./script1.sh & #this doesn't blocks!
./script2.sh

回答by jaypal singh

Run the first one in background using &and you should be good.

在后台使用第一个运行&,你应该很好。