no submod

This commit is contained in:
Bel LaPointe
2023-04-17 11:20:05 -06:00
parent 026e7718ed
commit 8970da11e5
60 changed files with 4326 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
#! /bin/bash
cache() (
path() {
echo "$CACHE/$(echo "$*" | base64 | md5sum | awk '{print $1}')"
}
get() {
local path="$(path "$*")"
if ! [ -f "$path" ]; then
return 1
fi
if wc -c "$path" | grep -q '^[ ]*0[ ]*$'; then
return 1
fi
local created="$(date -r "$path" +%s)"
local now="$(date +%s)"
if ((now-created > CACHE_DURATION)); then
return 1
fi
cat "$path"
}
put() {
local path="$(path "$*")"
tee "$path"
}
"$@"
)