9

How can I send a command like following, but with default parameters (without user input). I want to use this in a shell script.

 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   
2
  • Have you tried dpkg --configure -a < standardresponse.txt? That would be my first try.
    – Jos
    Aug 5, 2015 at 9:29
  • Not quite sure I understand yr question well. Do you just want to just configure all unpacked but yet to be configured packages on yr box ? If so just add an alias in yr .bashrc or .bash_aliases file. E.g. alias confpack='dpkg --configure -a' . After you source yr .bashrc` file confpackwould then become yr new shortcut cmd. Sorry if I got yr question wrong.
    – Cbhihe
    Aug 5, 2015 at 10:26

1 Answer 1

8

That's a job for yes, if you always want the answer N:

yes N | dpkg --configure -a

Or Y (works without an argument):

yes | dpkg --configure -a

Or over the dpkg options, see 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
[...]

Use then (for example):

dpkg --configure -a --force-confnew

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .