python - & 在 bash 命令之后

标签 python linux bash shell

我不确定这个 bash 脚本中命令后的 & 是做什么的。

    python alt_pg ${args} &

此外,我正在修改的脚本的原始版本在命令开头没有使用“python”,这与“&”有关吗?

最佳答案

& 在你的 linux shell 下的“后台”中运行 python alt_pg ${args};但是,该脚本仍然与 shell 相关联。因此,如果 shell 停止,脚本也会停止。

旁注:您可以使用 nohup python alt_pg ${args} & 取消脚本与 shell 的关联。如果您像这样生成脚本,则脚本在退出 shell 后仍然存在。

关于python - & 在 bash 命令之后,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11796791/

相关文章:

python - 确定条件是否适用于列表的所有成员

python - 使用 vars() 不好吗

linux - 用于监视新创建目录的 Bash 脚本

python - 如何结合 django 和 gevent 的基础知识?

python - sklearn回归器: ValueError: Found arrays with inconsistent numbers of samples

linux - 用于修改 XSL 的命令行工具

linux - 追加到前几行的开头和结尾

json - 读取为 json 时出错

bash - Grep 命令被特殊字符反转?

Bash 嵌套循环从文件中读取行