Add .inc extension to libs
This commit is contained in:
16
bashutils.inc
Normal file
16
bashutils.inc
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/hint/bash
|
||||
|
||||
function shasum {
|
||||
command shasum <<<"$1" | awk '{ print $1 }'
|
||||
}
|
||||
|
||||
# once <command>
|
||||
function once {
|
||||
local flagname="__onceflag_$(shasum "$*")"
|
||||
if [[ -z ${!flagname} ]]; then
|
||||
declare -g "${flagname}"=1
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user