I have written a bash script which installs a number of packages, however for each consecutive package installation i am promoted with the following message:
After this operation, 1,006 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Is there a way of setting the default to Y so no user input is required? My script is expected to run at night without any intervention
thanks in advance
Two methods come to mind. The first (and better option) is to use the options in your package manager. For example:
apt-get install -y [YOUR_PACKAGE]
if you use apt
(type apt-get install --help
for more help there).
The second is more of a quick-'n-dirty one...use a pipe after yes
:
yes | apt-get install [YOUR_PACKAGE]
which always brings a smile to my face :p
The latter option also answers yes to ALL other questions, which can be handy (errors etc.) but can be risky (which is the reason those questions are there in the first place!)
I think that message looks like you are using apt-get.
In that case you can use the flag --assume-yes
or shorter: -y
, which should automatically answer yes to that question without prompting the user
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With