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 am making a bash script that installs various packages using apt-get install. However, I notice that if there is a line that says:

sudo apt-get install package1 package2 package3

and either of the packages is not found, none of the others will be installed. How do I make it keep going even if it can't find one of the packages?

Thanks in advance.

share|improve this question
up vote 15 down vote accepted

I suggest an apt-get option

sudo apt-get --ignore-missing install $list_of_packages

but be aware that missing dependences cannot be ignored, and even if you use --force you can get a broken system.

share|improve this answer
    
Thank you! This seems to work. – Hypercube May 20 '11 at 20:57
    
Note that --ignore-missing only workarounds for an issue in download. See superuser.com/a/844627/106974 – IsaacS Apr 5 at 20:22
    
This actually does not work. – leoheck Jun 3 at 17:58
for i in package1 package2 package3; do
  sudo apt-get install $i
done
share|improve this answer
1  
A bit brutal performance wise (package dependency tree is being built from the scratch for every iteration), but should work fine. – Serge Broslavsky May 3 '11 at 5:53

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.