Skip to content

Instantly share code, notes, and snippets.

@trivoallan
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save trivoallan/9a4b16cd23b3c2a8c0d3 to your computer and use it in GitHub Desktop.

Select an option

Save trivoallan/9a4b16cd23b3c2a8c0d3 to your computer and use it in GitHub Desktop.
Sublime Text 3 local installer
#!/bin/bash
# Downloads Sublime Text 3 and installs it locally in user's home directory
# Better error reporting
function error_handler() {
echo "Error occurred in script at line ${1}"
echo "Line exited with status: ${2}"
}
trap 'error_handler ${LINENO} $?' ERR
# Fail fast !
set -o errexit
set -o errtrace
set -o nounset
# Check already existing installation
if [ -d "$HOME/sublime_text_3" ]; then
echo "Sublime Text 3 is already installed in $HOME/sublime_text_3. Aborting."
exit 255
fi
# Download ST3
urlDownload="http://c758482.r82.cf2.rackcdn.com/sublime_text_3_build_3065_x32.tar.bz2"
cd $HOME
wget $urlDownload
# Extract archive
tar xjf $(basename $urlDownload)
# Tell the world !
echo
echo "Launch Sublime Text 3 by executing the following command :"
echo
echo " cd $HOME/sublime_text_3 && ./sublime_text"
echo
echo "Bisous !"
echo
# Exit successfully
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment