This looks good:
for i in package1 package2 package3; do
sudo apt-get install -y $i
done
but with the packages listed in a file:
package1
package2
..
each on its own line. Looking for simplest script to read, performance not really an issue. Of course, the odd package will require some human intervention during install to agree or for configuration.
As an aside, what's the "real" way of dealing with large lists of packages to be installed? I'm just looking for monkey-see-monkey-do.
There is the
xargs
program which transforms a file to command-line arguments. Simply prependxargs
to the command (with all arguments) for which you’d like to supply additional arguments from the file (let’s call itlist.txt
) and letxargs
to read your file using standard input redirection.You can test it by putting
echo
before (or instead of)sudo
or removing the-y
option.Something like this?