How do I write an application install shell script?

I would assume the script would look something like this:

#!/bin/sh
apt-get update  # To get the latest package lists
apt-get install <package name> -y
#etc.

Just save that as something like install_my_apps.sh, change the file's properties to make it executable, and run it from the command line as root.

(Edit: The -y tells apt-get not to prompt you and just get on with installing)


Well, according to your question the easiest script would be:

#!/bin/sh
LIST_OF_APPS="a b c d e"

aptitude update
aptitude install -y $LIST_OF_APPS

However you could also enter aptitude update && aptitude install -y a b c d e. So maybe your question is missing the crucial point here. If there are some further requirements it would be nice to explain them.


Just create a list of apps in a file, example.list, and run

cat example.list | xargs sudo apt-get -y install