|
Linux and Mac system default shell is bash, but the real power should belong to zsh shell, and completely control the bash, is the shell of the ultimate killer, there are many features not bash, but zsh initial configuration is too complicated, popular rate has been low, until a man named Robby Russell guy on github developed oh-my-zsh project, so that we use zsh convenience is greatly improved.
Since the company's computer is windows, toss under cygwin, and installed zsh, so start with a lot of convenience to maintain, and I put autojump projects are integrated together, and finally wrote a script automatic installation, you can automatically from the current bash installation environment Oh-my-zsh, autojump and initialize zsh. Currently only supports Ubuntu, CentOS, Debian.
I gather that this zsh profile online support plugin (git autojump history history-substring-search systemadmin systemd), a detailed program to see the plugin source code ~ .oh-my-zsh / plugins /.
See autojump autojump use of official documents. https://github.com/wting/autojump
history-substring-search Search history bright very strong, strong enough to make you suddenly tongue.
systemadmin SA integrates many commonly used commands.
systemd for centos7 after systemctl streamlining of intelligence.
#! / Bin / bash
#Author: Shanker
#set -x
#set -u
clearhacker
echo ""
echo "################################################ ############# "
echo "# Automatically to Install oh-my-zsh and initialize it #"
echo "# Intro: https://github.com/sangrealest/shanker #"
echo "# Author: Shanker #"
echo "################################################ ############# "
echo ""
#if [ `id -u` -ne 0]
#then
# Echo "Need root to run is, try with sudo"
# Exit 1
#fi
function checkOs () {
if [-f / etc / RedHat-release]
then
OS = "CentOS"
elif [-z! "` cat / etc / issue | grep -i bian` "]
then
OS = "Debian"
elif [-z! "` cat / etc / issue | grep -i ubuntu` "]
then
OS = "Ubuntu"
else
echo "Not supported OS"
exit 1
fi
}
function installSoftware () {
if [ "$ OS" == 'CentOS']
then
sudo yum -y install zsh git
else
sudo apt-get -y install zsh git
fi
zshPath = "` which zsh` "
}
function downloadFile () {
cd ~
git clone https://github.com/robbyrussell/oh-my-zsh.git ~ / .oh-my-zsh
git clone https://github.com/joelthelion/autojump.git
git clone https://github.com/sangrealest/initzsh
}
function installAutojump () {
cd ~ / autojump
./install.py
cat >> ~ / .zshrc << EOF
[[-s ~ / .autojump / Etc / profile.d / autojump.sh]] && source ~ / .autojump / etc / profile.d / autojump.sh
autoload -U compinit && compinit -u
EOF
}
function configZsh () {
if [-f ".zsh_history"]
then
mv .zsh_history {., backup}
fi
sudo chsh -s "$ zshPath"
cp ~ / initzsh / zshrc ~ / .zshrc
}
function main () {
checkOs
installSoftware
downloadFile
configZsh
installAutojump
}
main
If cygwin use zsh, you only need to add a line inside the .bashrc / bin / zsh can. |
|
|
|