Changes to shell template

This commit is contained in:
chawley@hq.overdrive.com (chawley-vm)
2021-02-02 15:46:06 -05:00
parent 2b9da46949
commit 961b7864ad
2 changed files with 17 additions and 6 deletions

View File

@@ -18,9 +18,20 @@ set -o nounset # Treat unset variables as an error
# Check for empty argument
if [ -z "${1:-}" ]; then
arg="undefined"
arg="undefined"
echo "Required Argument Missing"
#exit 1
else
arg=$1
arg=$1
fi
.
# Log Echo: send output to screen and specified file
# Usage: logecho "Log Message"
# define logfile and path to enable logging to file
logfile=
logecho() {
echo "${1}"
if [[ ! -z "${logfile}" ]]; then
echo "${1}" >> "${logfile}"
fi
}

6
.vimrc
View File

@@ -236,11 +236,11 @@ nnoremap ,begend :-1read $HOME/.vim/templates/begend<CR>jA
" ==> Templates: shell scripts (.sh)
autocmd BufNewFile *.sh so $HOME/.vim/templates/sh
autocmd BufNewFile *.sh %s/FILE:.*/\='FILE: '.expand('%')/e
autocmd BufNewFile *.sh %s/FILE:.*/\='FILE: '.expand('%:t')/e
autocmd BufNewFile *.sh exe "g/AUTHOR:.*/s//AUTHOR: C Hawley"
autocmd BufNewFile *.sh exe "g/CREATED:.*/s//CREATED: " .strftime("%c")
autocmd BufNewFile *.sh exe "g/CREATED:.*/s//CREATED: " .strftime("%Y-%m-%d")
autocmd BufWritePre,filewritepre *.sh execute "normal ma"
autocmd BufWritePre,filewritepre *.sh exe "g/REVISION:.*/s//REVISION: " .strftime("%c")
autocmd BufWritePre,filewritepre *.sh exe "g/REVISION:.*/s//REVISION: " .strftime("%Y-%m-%d")
autocmd bufWritePost,filewritepost *.sh execute "normal `a"
" ---------------------------------------------------------------------------------------------------------------------