diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-08-21 21:47:54 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-08-21 21:47:54 +1200 |
commit | f609986735b0a381d6ad95ad30a62f1fdf8169a8 (patch) | |
tree | e30122819eba1d56d4984e841c5ab1a8f78dafcb | |
parent | Add missing slash to comment (diff) | |
download | dotfiles-f609986735b0a381d6ad95ad30a62f1fdf8169a8.tar.gz dotfiles-f609986735b0a381d6ad95ad30a62f1fdf8169a8.zip |
Add arg checks to chc(1df)
-rw-r--r-- | bin/chc.sh | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 |