(为了跳过你肯定的磁盘空间警告)我试图apt-get install php && echo Y但它不起作用。 它仍然要求警告。
我可以做什么?
谢谢!
手册页说你应该使用-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
您需要了解&&实际正在做什么,如果先前的命令成功退出,则会通知shell运行以下命令。 所以你要求的是echo Y如果安装工作,这显然不是你想要的。
你可能会有一些成功
echo Y | apt-get install php
但是,阅读您将find的文档,您将获得更多的成功
-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
是你想要的。