sh 通过POSIX shell脚本在Linux上安装Sublime Text 3 - http://simonewebdesign.it/install-sublime-text-3-on-li

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 通过POSIX shell脚本在Linux上安装Sublime Text 3 - http://simonewebdesign.it/install-sublime-text-3-on-li相关的知识,希望对你有一定的参考价值。

#!/bin/sh

# Sublime Text 3 install with Package Control (last update: 25 September 2016)
#
# No need to download this script, just run it on your terminal:
#
#  $  curl -L git.io/sublimetext | sh


# Detect the architecture
if [[ "$(uname -m)" = "x86_64" ]]; then
  ARCHITECTURE="x64"
else
  ARCHITECTURE="x32"
fi

# Fetch the latest build version number (thanks daveol)
BUILD=$(echo $(curl http://www.sublimetext.com/3) | sed -rn "s#.*The latest build is ([0-9]+)..*#\1#p")

URL="https://download.sublimetext.com/sublime_text_3_build_{$BUILD}_{$ARCHITECTURE}.tar.bz2"
INSTALLATION_DIR="/opt/sublime_text"


# Download the tarball, unpack and install
curl -o $HOME/st3.tar.bz2 $URL
if tar -xf $HOME/st3.tar.bz2 --directory=$HOME; then
  sudo mv $HOME/sublime_text_3 $INSTALLATION_DIR
  sudo ln -s $INSTALLATION_DIR/sublime_text /bin/subl
fi
rm $HOME/st3.tar.bz2


# Package Control - The Sublime Text Package Manager: https://packagecontrol.io
curl -o $HOME/Package\ Control.sublime-package https://packagecontrol.io/Package%20Control.sublime-package
sudo mv $HOME/Package\ Control.sublime-package "$INSTALLATION_DIR/Installed Packages/"


# Add to applications list (thanks 4ndrej)
sudo ln -s $INSTALLATION_DIR/sublime_text.desktop /usr/share/applications/sublime_text.desktop

# Set the icon (thanks gcaracuel)
sudo sed -i.bak 's/Icon=sublime-text/Icon=\/opt\/sublime_text\/Icon\/128x128\/sublime-text.png/g' /usr/share/applications/sublime_text.desktop

echo '
Sublime Text 3 installed successfully!
Run with: subl
'

以上是关于sh 通过POSIX shell脚本在Linux上安装Sublime Text 3 - http://simonewebdesign.it/install-sublime-text-3-on-li的主要内容,如果未能解决你的问题,请参考以下文章

sh 通过POSIX shell脚本在Linux上安装Sublime Text 3 - http://simonewebdesign.it/install-sublime-text-3-on-li

bash和sh的区别

c shell 和bash有啥区别

在ubuntu中如何安装shell 脚本程序

如何通过php页面执行shell脚本?

Linux Shell 按Tab键不能补全