我有一个用于安装服务器的无人值守脚本。在脚本的开头有一个sudo apt-get dist-upgrade --yes. dist 升级的最后有一个令人讨厌的用户输入屏幕,要求重新启动服务:

是否可以自动接受服务重新启动或禁用此屏幕?它破坏了我的整个剧本。另外我担心它可能会让我的服务器在更新时卡在某个时刻......
与 apt-get Upgrade 的结果相同
编辑:我尝试过但没有成功:
#!/bin/bash
sudo apt-get update
sudo apt-get remove apt-listchanges --assume-yes --force-yes &&
#using export is important since some of the commands in the script will fire in a subshell
export DEBIAN_FRONTEND=noninteractive &&
export APT_LISTCHANGES_FRONTEND=none &&
#lib6c was an issue for me as it ignored the DEBIAN_FRONTEND environment variable and fired a prompt anyway. This should fix it
echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections &&
echo "executing …Run Code Online (Sandbox Code Playgroud)