自己写了一个脚本可以改变系统shell输出的颜色及vi文件的自动缩进和快速查询等等,只要执行一下脚本就可以拥有高效的vi编辑模式了。各位可以帮忙指点一下,看看是否可以改进。
#!/bin/bash
#Change output display
#Author@wolfguo 
#Mail:wolfguoliang@gmail.com
a="Change successful"
b="change failed"
c="/root/.bashrc"
echo 'export PS1="[\e[36;1m\u@\e[32;1m\h \e[34;1m\W]\\$" ' >> /etc/profile  #更改输出显示
if [ $? = 0 ];then
echo "$a"
else
echo "$b"
fi
echo 'set nohls
set nocompatible
filetype on
filetype indent on
filetype plugin on
set autoindent
set smartindent
set showmatch
set ruler
set incsearch
set hlsearch
set nu' >> /etc/vimrc
if [ $? = 0 ];then
echo "$a"
else
echo "$b"
fi
cd /root/
echo ' alias vi=vim ' >>.bashrc
if [ $? = 0 ] ; then
echo "$a"
source $c
else
echo "$b"