如下代碼中#是單行註釋
:<<!
!
是多行註釋。php
運行的時候須要把多行註釋去掉。node
好比把如下代碼保存爲install.sh, 那麼在終端運行sh install.sh。linux
如下代碼逐段經過測試,還沒有完整測試。
20171125git
#!/bin/sh # 安裝搜狗拼音 :<<! echo "安裝搜狗拼音..." if [ ! -f "./sogoupinyin_amd64.deb"]; then echo "不存在sogoupinyin_amd64.deb" echo "開始下載sogoupinyin_amd64.deb" wget -c "https://pinyin.sogou.com/linux/download.php?f=linux&bit=64" -O "sogoupinyin_amd64.deb" echo "開始安裝sogoupinyin_amd64.deb" sudo dpkg -i sogoupinyin_amd64.deb sudo apt -f -y install sudo dpkg -i sogoupinyin_amd64.deb else echo "開始安裝sogoupinyin_amd64.deb" sudo dpkg -i sogoupinyin_amd64.deb sudo apt -f -y install sudo dpkg -i sogoupinyin_amd64.deb fi ! # 安裝網易雲音樂 :<<! echo "安裝網易雲音樂..." if [ ! -f "./netease-cloud-music_amd64_ubuntu.deb" ]; then echo "不存在netease-cloud-music_amd64_ubuntu.deb" echo "開始下載netease-cloud-music_amd64_ubuntu.deb" wget "http://d1.music.126.net/dmusic/netease-cloud-music_1.1.0_amd64_ubuntu.deb" -O "netease-cloud-music_amd64_ubuntu.deb" echo "開始安裝netease-cloud-music_amd64_ubuntu.deb" sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb sudo apt-get -f install sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb else echo "開始安裝netease-cloud-music_amd64_ubuntu.deb" sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb sudo apt-get -f install sudo dpkg -i netease-cloud-music_amd64_ubuntu.deb fi ! # 安裝unity-tweak-tool,並設置任務欄單擊最小化 :<<! echo "安裝unity-tweak-tool..." sudo apt -y install unity-tweak-tool gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-minimize-window true ! # 安裝WPS :<<! echo "安裝WPS..." if [ ! -f "./wps-office_amd64.deb" ]; then echo "不存在wps-office_amd64.deb" echo "開始下載wps-office_amd64.deb" wget "http://kdl.cc.ksosoft.com/wps-community/download/a21/wps-office_10.1.0.5672~a21_amd64.deb" -O "wps-office_amd64.deb" echo "開始安裝wps-office_amd64.deb" sudo dpkg -i wps-office_amd64.deb unzip -d ./temp/ wps_symbol_fonts.zip cd temp sudo cp mtextra.ttf symbol.ttf WEBDINGS.TTF wingding.ttf WINGDNG2.ttf WINGDNG3.ttf /usr/share/fonts else echo "開始安裝wps-office_amd64.deb" sudo dpkg -i wps-office_amd64.deb unzip -d ./temp/ wps_symbol_fonts.zip cd temp sudo cp mtextra.ttf symbol.ttf WEBDINGS.TTF wingding.ttf WINGDNG2.ttf WINGDNG3.ttf /usr/share/fonts fi ! # 卸載沒必要要軟件 :<<! echo "卸載libreOffice" sudo apt-get remove libreoffice-common echo "卸載Amazon" sudo apt-get remove unity-webapps-common sudo apt autoremove ! # 安裝谷歌瀏覽器 :<<! echo "安裝谷歌瀏覽器..." if [ ! -f "./google-chrome-stable_current_amd64.deb" ]; then echo "不存在google-chrome-stable_current_amd64.deb" echo "開始下載google-chrome-stable_current_amd64.deb" wget "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" -O "google-chrome-stable_current_amd64.deb" sudo dpkg -i google-chrome-stable_current_amd64.deb sudo apt -f -y install else sudo dpkg -i google-chrome-stable_current_amd64.deb sudo apt -f -y install fi ! # 安裝git :<<! echo "安裝git..." sudo apt -y install git sudo apt autoremove ! # 安裝sublime text3 :<<! echo "安裝sublime text3..." if [ ! -f "./sublime_text_3_build_3143_x64.tar.bz2" ]; then echo "不存在sublime_text_3_build_3143_x64.tar.bz2" echo "開始下載sublime_text_3_build_3143_x64.tar.bz2" wget "https://download.sublimetext.com/sublime_text_3_build_3143_x64.tar.bz2" -O "sublime_text_3_build_3143_x64.tar.bz2" sudo dpkg -i sublime_text_3_build_3143_x64.tar.bz2 sudo tar -xjvf sublime_text_3_build_3143_x64.tar.bz2 sudo mv sublime_text_3 /opt/ sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl else sudo dpkg -i sublime_text_3_build_3143_x64.tar.bz2 sudo tar -xjvf sublime_text_3_build_3143_x64.tar.bz2 sudo mv sublime_text_3 /opt/ sudo ln -s /opt/sublime_text_3/sublime_text /usr/bin/subl fi ! # 安裝微信 :<<! echo "正在安裝微信..." if [ -f "/usr/local/bin/node" ]; then sudo rm -rf /usr/local/bin/node fi if [ -f "/usr/local/bin/npm" ]; then sudo rm -rf /usr/local/bin/npm fi sudo rm -rf /opt/node-linux-x64 sudo apt autoremove npm sudo apt autoremove node if [ ! -f "./node-linux-x64.tar.xz" ]; then wget "https://nodejs.org/dist/v8.9.1/node-v8.9.1-linux-x64.tar.xz" -O "node-linux-x64.tar.xz" tar -xvJf node-linux-x64.tar.xz mv node-v8.9.1-linux-x64/ ./node-linux-x64 sudo mv node-linux-x64 /opt/ sudo ln -s /opt/node-linux-x64/bin/node /usr/local/bin/node sudo ln -s /opt/node-linux-x64/bin/npm /usr/local/bin/npm else tar -xvJf node-linux-x64.tar.xz mv node-v8.9.1-linux-x64/ ./node-linux-x64 sudo mv node-linux-x64 /opt/ sudo ln -s /opt/node-linux-x64/bin/node /usr/local/bin/node sudo ln -s /opt/node-linux-x64/bin/npm /usr/local/bin/npm fi cd mkdir software cd software git clone https://github.com/geeeeeeeeek/electronic-wechat.git cd electronic-wechat npm install && npm start ! # 安裝typora,一款好用的markdown編輯器 :<<! echo "正在安裝typora..." sudo add-apt-repository 'deb https://typora.io linux/' sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA300B7755AFCFAE sudo apt update sudo apt install typora ! # 安裝System Monitor :<<! echo "正在安裝System Monitor..." sudo add-apt-repository ppa:fossfreedom/indicator-sysmonitor sudo apt-get update sudo apt-get install indicator-sysmonitor indicator-sysmonitor & # 按ctrl+C退出 !