0

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
Ciro
  • 141
  • 3
  • 12

1 Answers1

2

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.

Charles Green
  • 20,952
  • 21
  • 60
  • 92
  • I downloaded an .sh file to install an application in Ubuntu. Do I changed the folder to the download terminal then follow your instructions? I do not want the application installed in the Download folder. – Jose Enrique Calderon Mar 15 '19 at 10:09
  • @JoseEnriqueCalderon Please see [https://askubuntu.com/questions/38661/how-do-i-run-sh-files](https://askubuntu.com/questions/38661/how-do-i-run-sh-files) – Charles Green Mar 15 '19 at 12:39