Jun*_*ior 0 shell background-process disown
mplayer -vo null -ao alsa test.mp3 & disown
Run Code Online (Sandbox Code Playgroud)
它返回
sh: 1 : disown: not find
Run Code Online (Sandbox Code Playgroud)
为什么它不起作用?
很可能,你的 shell 不是bash
但dash
它没有disown
. 做fgrep $(id -n) /etc/password
看看你的外壳是否是bash
. 如果不是,则更新它,重新登录,您将能够拒绝进程。
如果您想继续使用当前的 shell(缺少disown
内置程序),您可以使用它nohup your_command_here &
来实现几乎相同的行为。
disown
和之间的区别在于,nohup
它disown
阻止了 shell 将 HUP 发送到被否认的进程,同时nohup
安装了一个处理程序,该处理程序忽略了 shell 在出口处发送的 HUP 信号。