Bash Script That Automates A Software Install I am trying to create a bash script that automates all parts of a .dmg/pkg software install. 

For example, the script should pull the installer from here: http://download.techsmith.com/snagitmac/enu/Snagit.dmg

It should pull the installer from online, run the installer, automatically proceed past all the user prompts, and run root so the user should just have to run the script.

Is there anyway to make the snag it installer proceed without human interaction and finish the installer via this script?

This is the script I have so far:

#!/bin/bash -e

cd ~/Desktop
curl -O http://download.techsmith.com/snagitmac/enu/Snagit.dmg
The following should work for Snagit (and, with adaptions, for any application which is delivered in a .dmg and must be dragged to /Applications manually). It will not work for package installers.

#!/bin/bash

cd ~/Desktop

# get image from site
curl -O http://download.techsmith.com/snagitmac/enu/Snagit.dmg

# mount image
hdiutil attach Snagit.dmg

# copy app, remove old version first if installed
if [[ -d /Applications/Snagit.app ]]; then
    sudo rm -rf /Applications/Snagit.app
fi
sudo cp -r /Volumes/Snagit/Snagit.app /Applications/Snagit.app

# unmount and remove image
hdiutil detach /Volumes/Snagit
mv Snagit.dmg ~/.Trash/