如何为 dpkg --configure -a 设置默认选项?

Adr*_*n B 7 apt dpkg bash

如何发送如下命令,但使用默认参数(无需用户输入)。我想在 shell 脚本中使用它。

 dpkg --configure -a ...

 ==> Modified (by you or by a script) since installation.  ==> Package  
distributor has shipped an updated version.    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     : start a shell to examine the situation  The default action is to keep your current version.  
*** CONFIGFILE (Y/I/N/O/D/Z) [default=N] ? ^C   
Run Code Online (Sandbox Code Playgroud)

cha*_*aos 8

yes如果您总是想要答案,那是 的工作N

yes N | dpkg --configure -a
Run Code Online (Sandbox Code Playgroud)

Y(无需参数即可工作):

yes | dpkg --configure -a
Run Code Online (Sandbox Code Playgroud)

或在dpkg选项上,请参阅dpkg --force-help

[...]
[!] confnew            Always use the new config files, don't prompt
[!] confold            Always use the old config files, don't prompt
[!] confdef            Use the default option for new config files if one
                       is available, don't prompt. If no default can be found,
                       you will be prompted unless one of the confold or
                       confnew options is also given
[...]
Run Code Online (Sandbox Code Playgroud)

然后使用(例如):

dpkg --configure -a --force-confnew
Run Code Online (Sandbox Code Playgroud)