我跑
nohup bash -c "while [ true ]; do echo test; done"
Run Code Online (Sandbox Code Playgroud)
来自PuTTySSH 客户端,但在此进程不在后台运行之后,而是nohup在 shell 中保持为前台进程。
软件版本: nohup (GNU coreutils) 8.5
nohup bash -c "while [ true ]; do echo test; done" &
Run Code Online (Sandbox Code Playgroud)
Nohup 为您提供对挂断信号的免疫力。但它不会自动将进程设置为后台。
命令末尾的 & 导致它在后台运行。