installing programs from the bash script
Solution 1
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.
Solution 2
The yes
command is useful here
yes | ./install_script.sh
Related videos on Youtube
![Pushpak Dagade](https://i.stack.imgur.com/IMv3L.jpg?s=256&g=1)
Pushpak Dagade
My LinkedIn profile: https://in.linkedin.com/in/pushpak-dagade-47275121
Updated on September 18, 2022Comments
-
Pushpak Dagade almost 2 years
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 selectY
(yes) myself.Is there some way in which I can override this confirming mechanism so that I don't have to press
y
everytime? -
Pushpak Dagade almost 13 yearsIf installation of some package, say pkg2 fails, will the installation of remaining packages still continue?
-
enzotib almost 13 yearsThis 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.
-
Pushpak Dagade almost 13 yearsThank you. And what if some pkg depends on some other package not already installed? Will it install the dependencies as well?
-
enzotib almost 13 yearsYes, of course it will select for installation dependencies and recommended packages too.
-
Thomas Ward almost 13 yearsThe 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 onpkg1
, andpkg1
fails,pkg2
's install fails)