#!/usr/bin/env bash
function usage() {
echo -e "Usage:";
echo -e "\t$0 -a - Alert";
echo -e "\t$0 -v - Verbose mode";
echo -e "\t$0 -h - Show this help";
}
while getopts "avh" opt;
do
case $opt in
a)
PARAM_A="PARAM_A";
;;
v)
PARAM_V="PARAM_V";
;;
h)
usage;
exit 0;
;;
*)
usage;
exit 1;
;;
esac
done
test -z "$PARAM_A" && test -z "$PARAM_V" && {
echo "You should not pass!";
usage;
exit 2;
}
test -n "${PARAM_V}" && echo -e "Beep!";
test -n "${PARAM_A}" && echo -en "\a";
exit 0;