Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

2 Answers 2

up vote 7 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? –  Guanidene Jul 19 '11 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 '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? –  Guanidene Jul 19 '11 at 7:02
1  
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 W. Jul 19 '11 at 14:36

The yes command is useful here

yes | ./install_script.sh
share|improve this answer

Your Answer

 
discard

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.