Using Here Document to Install Packages in Ubuntu without Confirmation

While restoring my apps, I was thinking, how can I install a package from a list that I saved, without having to export them. Well, I thought of this loop, which can be used to either install one package or a multiple package. What started as one line, ended up in full fledge script!

getting packages from packages.txt file

while read line; do 
sudo apt-get install $line << INSTALL 
done < packages.txt

installing one package without waiting to press “y” for confirmation

sudo apt-get install -y --force-yes package


sudo apt-get install package << INSTALL
Share This!

Add a Comment

Your email address will not be published.

Sign up for our Newsletter

Download "Google Search Pro"

Enter your email and stay on top of things,