I am attempting to create a robust script to install Virtualbox without hardcoding the version number. I would like to have this capability so that I do not install an old version of Virtualbox when I run the script in the future (or need to manually update the script to the correct version). Is this possible? Side note: I see that the file "LATEST.TXT" in http://download.virtualbox.org/virtualbox/ contains the most recent version number. How can I use this to accomplish the above?
#Installation script containing hardcoded version number
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install virtualbox-4.2 -y -f #Hardcoded version number
wget http://download.virtualbox.org/virtu...0.vbox-extpack #Hardcoded version number
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.0.vbox-extpack --replace
#Installation script containing hardcoded version number
sudo sh -c 'echo "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install virtualbox-4.2 -y -f #Hardcoded version number
wget http://download.virtualbox.org/virtu...0.vbox-extpack #Hardcoded version number
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.0.vbox-extpack --replace