I want to make a .sh file that installs a package. Do I have to write this this?:
#!/bin/sh
# start a terminal session in the background
sudo apt-get install thepackage
exit 0
Most packages can be installed using a script like yours. You do need to answer the question "install (Y/n)" that apt-get
asks:
sudo apt-get install -y <packagename>
will work for all but a few packages that open up a terminal during configuration, such as the ttf-mscorefonts-installer
Look through the link sent in the comment by @bodhi.zazen, particularly the first chapter. There are some basic bits about script files you are missing.