add script
This commit is contained in:
parent
3510f44ef8
commit
89053e3ed1
@ -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
12
script/add_function.sh
Executable 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"
|
Loading…
Reference in New Issue
Block a user