(为了跳过“你确定吗”的磁盘空间警告)我试过了,apt-get install php && echo Y
但是没有用。它仍然要求发出警告。
我可以做什么?
谢谢!
答案1
手册页说您应该使用该-y
选项。
-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 or removing an essential package, occurs
then apt-get will abort.
也就是说:
apt-get -y install php
答案2
您需要了解 && 实际在做什么,如果先前的命令成功退出,它会告诉 shell 运行以下命令。因此,您要求的是echo Y
安装是否有效,这显然不是您想要的。
你可能会成功
echo Y | apt-get install php
但如果你阅读文档,你会发现
-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 or removing an essential package, occurs then apt-get will abort.
所以
apt-get -y install php
就是你想要的。