Using Here Document to Install Packages in Ubuntu without Confirmation
March 21, 2014
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 y INSTALL done < packages.txt |
installing one package without waiting to press “y” for confirmation
sudo apt-get install -y --force-yes package |
or
sudo apt-get install package << INSTALL y INSTALL |