送给经常写shell脚本的兄弟们
常写shell脚本的时候,大家一定都有困扰,怎么样能让.sh文件的表头自己生成,不用我们自己去敲呢

首先我们要编写一下/etc/vimrc
执行

vim /etc/vimrc

在里面插入一些代码即可

autocmd BufNewFile *.sh exec ":call Set()"

func Set()
call append(0,"#!/bin/bash")

call append(1,"#*********************************** ")

call append(2,"#* CreateTime " .strftime("%Y-%m-%d"))

call append(3,"#* scriptname: " .expand("%"))

call append(4,"#* email: 邮箱")

call append(5,"#* version: v0.1 ")

call append(6,"#* Author : ")

call append(7,"#*********************************** ")

endfunc

写Shell脚本自动生成首行-LMLPHP

希望对你有所帮助,感谢遇见!

05-11 02:59