#!/bin/bash
# Usage: script.sh [-a|--alpha] [-b=val|--bravo=val]
# Global Declarations
BRAVO=""
function usage(){
echo "That's not how it works, dummy!";
}
function suffadvtech(){
# DO MAGIC #
echo "Alpha hit!";
}
function magicincant(){
# DO SUFFICIENTLY-ADVANCED TECHNOLOGY #
echo "Bravo hit! Critical hit on $BRAVO!"
}
# Parse Parameters #
for inpFlags in $*; do
case $inpFlags in
-a|--alpha)
suffadvtech;
;;
-b=*|--bravo=*)
BRAVO=${inpFlags#*=}
magicincant;
;;
*)
echo "Unknown Argument $inpFlags!" ;;
esac
done
# Do Some Stuff #
echo "Usage script.sh -alpha --b=MYSTRING"
echo "B: $B"