Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # show usage if '-h' or '--help' is the first argument or no argument is given
- case $1 in
- ""|"-h"|"--help") PrSyn ;;
- esac
- # Define all acceptable variable names here
- ALL_OPT=(Type Host Pass User DB Table MaxTry BackupDir Src Dst Port sshUser Period dbExtra)
- Type="NULL" # We are using $Type to do syntax check in the call up loop
- Period="daily"
- for WORD in $@ ; do # $WORD is the name of variable,
- for OPT in ${ALL_OPT[*]} ; do # Check if I have the option in the list
- FIELDS=""
- case $WORD in
- $OPT=?*) # To make sure it has '=' and at least one character after '='
- FIELDS=${WORD:`echo ${#OPT}+1 |bc`} # grap the value
- eval $OPT=$FIELDS # Assign the variable to
- echo " export $OPT $FIELDS"
- ;;
- Report)
- echo "calling up Report"
- bkReport
- break
- ;;
- esac
- [ "$FIELDS" == "" ] || break # no value at all
- done
- done
- # Display all variable names and value
- for OPT in ${ALL_OPT[*]} ; do
- eval aaa=\$$OPT
- echo $OPT = $aaa
- done
- # Define all function names, which is the accepted variables value in first variable in ALL_OPT
- ALL_TYPE=(Mysql File MySql Redmine)
- [ $Type == "NULL" ] || for TypeCHK in ${ALL_TYPE[*]} ; do
- if [ $Type == $TypeCHK ] ; then
- ChkPeriod $Period
- [ $? == 0 ] && bk$Type #echo -e "\n\n== Running... bk$Type $TypeCHK"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement