我可以跳过终端安装时询问的问题吗?
我写sudo apt-get update && sudo apt-get upgrade && sudo shutdown -h 1
这些是为了在更新后关闭计算机。但我想知道如果在更新过程中弹出问题,比如 256 MB 更新,该怎么办y/n
?
答案1
添加-y
将sudo apt-get upgrade
使其假设是的对所有疑问。
-y, --yes, --assume-yes Automatic yes to prompts; assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package, trying to install a unauthenticated package or removing an essential package occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.
所以如果你让你的命令看起来像这样
sudo apt-get update && sudo apt-get upgrade -y && sudo shutdown -h 1
要在关机前避免出现新密码提示的风险,请执行以下操作
sudo sh -c "apt-get update && apt-get upgrade -y && shutdown -h 1"
它将运行并“回答”是的您在期间遇到的任何提示sudo apt-get upgrade
。
apt-get
有关终端中的命令类型的更多信息man apt-get
。