Nohup linux 命令等待额外的返回,我该如何防止?

Tra*_*vis 2 linux bash nohup

我在 bash 脚本中运行以下内容:

nohup java server_program.jar &
Run Code Online (Sandbox Code Playgroud)

我希望它开始运行并继续其快乐的方式。但是,出于某种原因,它说它正在忽略输入等并等待额外的返回键击。我可以删除此等待或从 bash 脚本中发送额外的返回吗?

Sve*_*ven 5

编写一个简短的“包装器”脚本来避免 nohup 重定向:

#!/bin/bash
printf "\n" | java server_program.jar &
Run Code Online (Sandbox Code Playgroud)

并运行它nohup scriptname.sh(记住使其可执行并且脚本可能不在您的路径中)。