#! /bin/bashread -p "Please input the username you want create: " NAME
ifid$NAME&> /dev/null;thenecho"$NAME already exists!"elseuseradd$NAME;id$NAMEfi
五、编写生成脚本基本格式的脚本,包括作者,联系方式,版本,时间,描述等
set et
set ts=4
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: cju277")
call setline(5,"#QQ: 12345678")
call setline(6,"#Date: ".strftime("%Y-%m-%d"))
call setline(7,"#Filename: ".expand("%"))
call setline(8,"#Description: The test script")
call setline(9,"#Copyright (C): ".strftime("%Y")." All rights reserved")
call setline(10,"#******************************************************************")
call setline(11,"")
endif
endfunc
autocmd BufNewFile * normal G