From 81e7fa9bf6ba0fcbfebb23d30ee4aaf4a93870c3 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Wed, 27 Feb 2013 22:45:53 +0100 Subject: [PATCH] parse options --- atom | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) mode change 100644 => 100755 atom diff --git a/atom b/atom old mode 100644 new mode 100755 index c84441f..9f6d926 --- a/atom +++ b/atom @@ -1,7 +1,44 @@ #!/bin/bash #parse arguments +OPTERR=0 +while getopts ':c:l:T:F:hD' opt +do + case $opt in + c) + cffile="$OPTARG" + ;; + l) + cliload="$OPTARG" + ;; + T) + cliltimer="$OPTARG" + ;; + F) + forceall+=("$OPTARG") + ;; + h) + help + exit 0 + ;; + D) + (( debug++ )) + ;; + :) + echo "-$OPTARG requires an argument" + help + exit 127 + ;; + *) + echo "Unrecognized option: -$OPTARG" + help + exit 127 + ;; + esac +done + #parse config + #check sanity getFiles() { @@ -71,7 +108,7 @@ checkLoad() { readUserInput() { #read + / - / q(uit) / p(ause) - #initiate shutdown / check load threshold / SIGSTOP all children / SIGCONT all children + #initiate shutdown / change load threshold / SIGSTOP all children / SIGCONT all children : } @@ -90,4 +127,4 @@ transcodeLauncher() { #UI -# vim:set ts=8,sw=8: +# vim:set ts=8 sw=8: