From: Ian Kelling Date: Mon, 29 Jul 2019 00:02:41 +0000 (-0400) Subject: better arg checking X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=2307b08212504845da46bff3eecbd8642e18e755 better arg checking --- diff --git a/btrbk-run b/btrbk-run index fa20061..3ec2221 100644 --- a/btrbk-run +++ b/btrbk-run @@ -150,9 +150,18 @@ while true; do esac done -# usefull commands are resume and archive +# only tested commands are resume and archive cmd_arg=${1:-run} +case $cmd_arg in + run|resume|archive) : ;; + *) die "untested command arg" ;; +esac + +if (( $# > 1 )); then + die: "only 1 nonoption arg is supported" +fi + if [[ -v targets && $source ]]; then die "error: -t and -s are mutually exclusive" fi