我有一个简单的Bash脚本,用于连接一系列服务器并更新特定的软件包,使用here-string来回答提示:
sudo /usr/bin/apt-get install package-name <<< Y
提示信息如下:
Configuration file /etc/package-name/package-name.conf
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
What would you like to do about it? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : background this process to examine the situation
The default action is to keep your current version.
*** package-name.conf (Y/I/N/O/D/Z [default=N] ?
这是当它无法工作时的错误:
dpkg: error processing package-name (--configure):
EOF on stdin a conffile prompt
Errors were encountered while processing:
package-name
我无法在服务器上安装expect或其他程序。希望能得到帮助。
sudo apt-get -o DPkg::Options::="--force-confnew" install package-name
- fja--force-confold
选项来获得相反的效果。 - kenorb