liunx用户环境初始化脚本
编写生成脚本基本格式,包括作者,联系方式,版本,时间,描述等
[root@magedu ~]# vim .vimrc set ignorecase set cursorline set autoindent autocmd BufNewFile *.sh exec ":call SetTitle()" func SetTitle() if expand("%:e") == 'sh' call setline(1,"#!/bin/bash") call setline(2,"#") call setline(3,"#********************************************************************") call setline(4,"#Author: w") call setline(5,"#QQ: 1****") call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#FileName: ".expand("%")) call setline(8,"#URL: http://www.magedu.com") call setline(9,"#Description: The test script") call setline(10,"#Copyright (C): ".strftime("%Y")." All rights reserved") call setline(11,"#********************************************************************") call setline(12,"") endif endfunc autocmd BufNewFile * normal G
编写用户的环境初始化脚本reset.sh,包括别名,登录提示符, vim的设置,环境变量,取OS版本号,网卡名更改,seliunx关闭等:
[09:26:08 root@centos ~]#vim reset.sh
1 #!/bin/bash
2 #
3 #****************************************************************
4 #Author: yangtao
5 #QQ: 1060351846
6 #Date: 2019-10-10
7 #FileName: reset.sh
8 #URL: https://www.cnblogs.com/www233ii/
9 #Description: The test script
10 #Copyright (C): 2019 All rights reserved
11 #***************************************************************
12 CS="