aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-08-21 21:47:54 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-08-21 21:47:54 +1200
commitf609986735b0a381d6ad95ad30a62f1fdf8169a8 (patch)
treee30122819eba1d56d4984e841c5ab1a8f78dafcb
parent16f81a60f9b83555d3bf9db7dfac56e0fdcde766 (diff)
downloaddotfiles-f609986735b0a381d6ad95ad30a62f1fdf8169a8.tar.gz
dotfiles-f609986735b0a381d6ad95ad30a62f1fdf8169a8.zip
Add arg checks to chc(1df)
-rw-r--r--bin/chc.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/chc.sh b/bin/chc.sh
index 8b15317c..ee030f5f 100644
--- a/bin/chc.sh
+++ b/bin/chc.sh
@@ -1,5 +1,12 @@
# Cache the output of a command and emit it straight from the cache if not
# expired on each run
+self=chc
+
+# Check arguments for sanity
+if [ "$#" -lt 3 ] ; then
+ printf >&2 '%s: Need a cache path, a duration, and a command\n' "$self"
+ exit 2
+fi
# First argument is the cache path, second is the duration in seconds
cac=$1 dur=$2