进入shell脚本编写的过程中,需要在第一行写#!/bin/bash 后面按照标准习惯写上作者,开发时间等,甚至在oracle某些操作中要上环境变量等信息,为了方便使用提前设置后的模板。
1 /etc/vimrc中查找模板配置语句并修改
[root@wzlvm ~]# vim /etc/vimrc
autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec -- 找到这一句,.spec 改为.sh
2 在家目录中设置模板路径
[root@wzlvm ~]# vim ~/.vimrc
1 set nu
2 set autoindent
3 color default
4 set et
5 set ts=4
6 set sts=4
7 set sw=4
8 set smarttab
9 set ai
10 set si
11 set ic
12 set hls is
13 autocmd BufNewFile *.sh 0r /usr/share/vim/vimfiles/template.sh -- 添加这一句
3 根据步骤2中的配置模板路径设置模板
vim /usr/share/vim/vimfiles/template.sh
1 #!/bin/bash
2 #
3 #
4 #
5 # Aut wangzilong
6 # Shell Document
到此,shell脚本模板语句设置完成。