Create a gist now

Instantly share code, notes, and snippets.

Gist updated to Sublime Text v2.0.2, 64bit
# Adapted from https://gist.github.com/henriquemoody/3288681
#!/bin/sh
SHORTCUT="[Desktop Entry]
Name=Sublime Text 2
Comment=Edit text files
Exec=/usr/local/sublime-text-2/sublime_text
Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Utility;TextEditor;"
SCRIPT="#!/bin/sh
if [ \${1} == \"--help\" ]; then
/usr/local/sublime-text-2/sublime_text --help
else
/usr/local/sublime-text-2/sublime_text \$@ > /dev/null 2>&1 &
fi"
curl -L "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.2%20x64.tar.bz2" -o "/usr/src/Sublime Text 2.tar.bz2"
cd /usr/src
tar -xvjf "Sublime Text 2.tar.bz2"
cd "Sublime Text 2"
mkdir -pv "/usr/local/sublime-text-2"
mv -fv * "/usr/local/sublime-text-2/"
echo "${SCRIPT}" > "/usr/local/bin/subl"
chmod +x "/usr/local/bin/subl"
echo "${SHORTCUT}" > "/usr/share/applications/sublime-text-2.desktop"
ln -s /usr/local/sublime-text-2/sublime_text /usr/bin/sublime-text
echo "Finish!"
@Vadim-Zenin

Hi,

Thanks for script, but does not work on Fedora 19.

[root@localhost Sublime Text 2]# mv -fv ./* "/usr/local/sublime-text-2/"
mv: cannot move ‘./Icon’ to ‘/usr/local/sublime-text-2/Icon’: Directory not empty
mv: cannot move ‘./lib’ to ‘/usr/local/sublime-text-2/lib’: Directory not empty
mv: cannot move ‘./Pristine Packages’ to ‘/usr/local/sublime-text-2/Pristine Packages’: Directory not empty

@ninosimeon

@Vadim-Zenin

I use fedora 19. It works perfectly, try before "chmod +x sublime-text-2.sh".

@sayak-sarkar
Owner

@Vadim-Zenin: looks like you have files from a previous installation lying about in /usr/local/sublime-text-2 directory.

I would highly recommend removing the previous /usr/local/sublime-text-2 directory and rerun the script. It should automatically take care of the download and installation.

@ptierno
ptierno commented Jan 28, 2014

When running 'subl' with no arguments it gives the error 'unary operator expected'.
Slightly modified if statement below:

if [[ $# -gt 0 ]]; then
  if ! [[ ${1} == '--help' ]]; then
    /opt/sublime-text-2/sublime_text $@ > /dev/null 2>&1 &
  else
    /opt/sublime-text-2/sublime_text --help
  fi
else
  /opt/sublime-text-2/sublime_text
fi
@Vadim-Zenin

Thanks. It works on Fedora 20.

@joseluisq

Yeah, this works fine on my Fedora 20,
Only type this on terminal:

sudo sh sublime-text-3-x86_64.sh

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment