Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 8 down vote accepted

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.

share|improve this answer
If installation of some package, say pkg2 fails, will the installation of remaining packages still continue? – Pushpak Dagade Jul 19 '11 at 6:57
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 '11 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? – Pushpak Dagade Jul 19 '11 at 7:02
Yes, of course it will select for installation dependencies and recommended packages too. – enzotib Jul 19 '11 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 '11 at 14:36

The yes command is useful here

yes | ./
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.