add script

This commit is contained in:
6543 2018-05-20 21:16:19 +02:00
parent 3510f44ef8
commit 89053e3ed1
2 changed files with 17 additions and 3 deletions

View File

@ -2,10 +2,12 @@
#remaster lib #remaster lib
[ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; } [ -d "<LIBDIR>" ] || { echo "LIBDIR not exist"; exit 1; }


#beginn func #<function> [param]

function <function>() {
#Code of <function>
}


#this func is standalone executable #this func is standalone executable
[ -n "$1" ] && { [ -n "$1" ] && {
check_user <function> $@
} }

12
script/add_function.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash

#check param
[ -z "$1" ] && { echo "$0 [name]"; exit 1; }
name="$1"

#gen function
cp "doc/lib-head+tail" "src/func/$name"
sed -i "s/<function>/$name/g" "src/func/$name"

#open
editor "src/func/$name"