Shell scripts to automatically generate write the first line

Often write shell scripts to the brothers
often write shell script, we must have problems, how to make the header file .sh own generation, do not knock it ourselves

First, we want to write about the / etc / vimrc
execution 

vim /etc/vimrc

 

In some of the code can be inserted inside

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

 

 

 I hope for your help, thank met!

Guess you like

Origin www.cnblogs.com/SpaceKiller/p/12052253.html