I am trying to make a bash
script that automates the installation of several packages that I use on any ubuntu
machine. I frequently create virtual machines either through Amazon AWS or Digital Ocean and would like to just run one script to install all the packages I use.
Some of the packages I would like to install are Emacs and Node.js
The normal way I install these would be to run apt-get install Emacs
, and while doing this I am always prompted with a warning about how much space this app will take up and if I am sure I want to continue.
Is there a way to automate this process, from a script, and always say "yes" to these prompts?
From the
OPTIONS
section ofman apt-get
There is a unix command called
Without options it outputs the string "y" repeatedly until killed.
To use it, simply pipe the result to the command where you need the confirmations:
Read more in the Unix man pages or in the SO post The “yes” command.
You can add
-y
To any library install to answer yesEg :
apt-get install -y nodejs
Eg :
apt-get install -y gnupg