From f609986735b0a381d6ad95ad30a62f1fdf8169a8 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 21 Aug 2017 21:47:54 +1200 Subject: Add arg checks to chc(1df) --- bin/chc.sh | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- cgit v1.2.3