Author Topic: Basic BASH Script Automatically Installs Programs in Ubuntu  (Read 150 times)

0 Members and 1 Guest are viewing this topic.

rsutter

  • Administrator
  • Sr. Member
  • *****
  • Posts: 46
  • I cut the board twice and it's still too short.
    • View Profile
Basic BASH Script Automatically Installs Programs in Ubuntu
« on: September 20, 2017, 05:20:58 PM »
Hello All,

I recently created a script that, when run from a terminal, automatically installs certain programs in Ubuntu or Ubuntu-like systems.

For a line by line annotated version, see www.fullbean.com/linux/bash-script.docx.
  With the exception of the first line, #!/bin/bash, the lines beginning with # are comments.  They are intended to explain what is going to happen as the script runs.  When it executes, the script ignores them.

If you plan to try template.txt out, rename it template without the .txt extension
and insert it in the home directory of your Ubuntu system.  Read the embedded comments if you choose to install it in the /bin directory of your system's root

My script relies heavily on the work of Joe Collins and information provided on his YouTube series; Bash Basics viewable at https://www.youtube.com/watch?v=eH8Z9zeywq0

My script continues two lines below this line
Ralph Sutter

#!/bin/bash
#This line is commented out
#The next line clears the screen
clear
#The next line displays Begin Script on the screen
echo "Begin Script"
#The next line inserts many carriage returns
echo "






 "
echo "Installing Google Chrome Stable"
#The next line installs Google Chrome
sudo apt install google-chrome-stable
echo "Line Breaks Here "

echo "   





 "
echo "Installing Audacity"
#The next line installs the audio editing program, Audacity
sudo apt install audacity

echo  "Line Breaks Here"
echo "       





 "
#The next line displays Installing VLC on the screen
echo "Installing VLC"
#The next line installs the video program. VLC
sudo apt install vlc
echo echo "





"
#The next line prints Complete! on the screen
echo "Complete!"
#The next line  displays System will restart in 30 seconds
echo "System will restart in 30 seconds"
#The next line tells the computer to go to sleep in 30 seconds.  Replace 30 with another value to change time to restart
sleep 30
#The next line reboots the system
sudo reboot
#Important
#In order to get this script to work, you have to change the read/write/execute settings.
#From the terminal and in the same directory that holds the file template
#type chmod +x template
#Run the command from the terminal by typing ./template | less
#If you store a bash script in the /bin directory instead of in your home directory, omit the ./ in front of ./template entering simply template
#Adding | less (pipe less) causes the  output to display one screen at a time. 
#Advance to the next line by hitting the Enter key
#Remove | less from ./template | less and the output will scroll across multiple screens without pausing
#Make sure that you do this from the directory in which template is located





« Last Edit: October 05, 2017, 09:54:55 AM by rsutter »