6

I wish to install a large number of programs from the software center on all my 8 machines. Installing each program individually would be time consuming so I decided to write a bash script for installing all these programs in 1 go. It looks something like this -

#! /bin/sh
apt-get install xyz1
apt-get install xyz2
apt-get install xyz3

(Am running this script as a super user)

Now the problem is that for almost every installation it asks me ..need to get 123 kb of archives. Continue [Y/n] ? Every time I have to select Y(yes) myself.

Is there some way in which I can override this confirming mechanism so that I don't have to press y everytime?

2 Answers 2

9

First of all, you can use

sudo apt-get install pkg1 pkg2 ... pkg3

and next, with the option -y, apt-get will not ask for confirmation.

5
  • 1
    If installation of some package, say pkg2 fails, will the installation of remaining packages still continue? Jul 19, 2011 at 6:57
  • 1
    This is hard to say, it depends on the reason of fail, I think. But it not change in the "multiline" approach, because if there is a reason blocking the package manager, it will be so also in a separate command.
    – enzotib
    Jul 19, 2011 at 6:59
  • Thank you. And what if some pkg depends on some other package not already installed? Will it install the dependencies as well? Jul 19, 2011 at 7:02
  • 1
    Yes, of course it will select for installation dependencies and recommended packages too.
    – enzotib
    Jul 19, 2011 at 7:11
  • The one thing to consider is that if a dependency is being installed, and then fails, that it will fail to install any of the packages that depend on that (i.e. if pkg2 depends on pkg1, and pkg1 fails, pkg2's install fails)
    – Thomas Ward
    Jul 19, 2011 at 14:36
4

The yes command is useful here

yes | ./install_script.sh

You must log in to answer this question.

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