Created
December 21, 2012 06:56
-
-
Save anonymous/4351118 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
case "$(uname -i)" in | |
('i386') | |
dl=`wget http://www.sublimetext.com/2 -O - |& grep '<li id="dl_linux_32">' | grep -Eo 'http://[^"]*'` | |
file="$(echo $dl | sed 's/.*\///')" | |
;; | |
('x86_64') | |
dl=`wget http://www.sublimetext.com/2 -O - |& grep '<li id="dl_linux_64">' | grep -Eo 'http://[^"]*'` | |
file="$(echo $dl | sed 's/.*\///')" | |
;; | |
esac | |
# Download and extract Sublime Text 2 | |
if [ -d "$HOME/Ubuntu One" ]; then | |
cd "$HOME/Ubuntu One" | |
if [ ! -d "$HOME/Ubuntu One/Sublime Text 2" ]; then | |
wget "$dl" && tar xf "$file" && rm "$file" | |
fi | |
target="$HOME/Ubuntu One/Sublime Text 2" | |
else | |
cd $HOME | |
if [ ! -d "$HOME/Sublime Text 2" ]; then | |
wget "$dl" && tar xf "$file" && rm "$file" | |
fi | |
target="$HOME/Sublime Text 2" | |
fi | |
# Create desktop file | |
if [ ! -f "$HOME/.local/share/applications/sublime.desktop" ]; then | |
mkdir -p "$HOME/.local/share/applications" | |
cat > "$HOME/.local/share/applications/sublime.desktop" <<ENDLINE | |
[Desktop Entry] | |
Type=Application | |
Name=Sublime Text 2 | |
Comment=Sublime Text is a sophisticated text editor for code, markup and prose. You'll love the slick user interface, extraordinary features and amazing performance. | |
Exec="$target/sublime_text" | |
Categories=Development; | |
Icon=$target/Icon/256x256/sublime_text.png | |
Terminal=false | |
StartupNotify=true | |
ENDLINE | |
fi | |
# Create symbolic link | |
if [ ! -f "$HOME/.local/bin/subl" ]; then | |
mkdir -p "$HOME/.local/bin" | |
ln -s "$target/sublime_text" $HOME/.local/bin/subl | |
if ! grep "$HOME/.local/bin" $HOME/.profile > /dev/null 2>&1; then | |
cat >> $HOME/.profile <<ENDLINE | |
if [ -d "\$HOME/.local/bin" ] ; then | |
PATH="\$PATH:\$HOME/.local/bin" | |
fi | |
ENDLINE | |
fi | |
fi |
Hi all,
I made another tool at http://fourdollars.github.com/quick/ to install Sublime Text 2.
$ quick update && quick install sublime-text
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quick Installation:
wget https://gist.github.com/raw/4351118/d77ea07caad30618c6594f126a0b716436bd23a3/sublime_linux_installer.sh -O - | bash -