Pizza is now runnable and catches all errors

This commit is contained in:
Oliver Rümpelein 2014-12-28 19:12:03 +01:00
parent 21916131b3
commit 48777d0129

View file

@ -9,35 +9,47 @@ PIZZARCV=
help() { help() {
echo "pizza - sent small ASCII-Icons by Mail" echo "pizza - sent small ASCII-Icons by Mail"
echo "--------------------------------------" echo "--------------------------------------"
echo "Usage: -p | --pizza Sent a pizza" echo "Usage: -p Sent a pizza (default)"
echo " -l | --love Sent a heart" echo " -l Sent a heart"
echo " -h | --help Print this help-message" echo " -m <addr> Receivers address non-optional)"
echo " -h Print this help-message"
} }
while getopts <argstring> ; do if [ ! $1 ]; then
<case> echo "Argument needed!"
help
exit 1
fi
while getopts "plhm:" opt; do
case ${opt} in
p )
: ${PIZZAART:="pizza"}
;;
l )
: ${PIZZAART:="heart"}
;;
m )
PIZZARCV="${OPTARG}"
;;
h )
help
exit 0
;;
\?)
help
exit 1
;;
esac
done done
: ${PIZZAART:="pizza"}
# if [ ! "$2" ]; then if [ ! $PIZZARCV ]; then
# mail -s "${PIZZAUSER} sent you a Pizza on ${PIZZAHOST}!" $1 < "${PIZZAINC}/pizza" echo "Argument '-m' and mailaddress needed!"
# exit 0 help
# else exit 1
# case "$1" in fi
# "-p" | "--pizza")
# mail -s "${PIZZAUSER} sent you a Pizza on ${PIZZAHOST}" $2 < "${PIZZAINC}/pizza" mail -s "${PIZZAUSER} sent you a ${PIZZAART} on ${PIZZAHOST}!" ${PIZZARCV} < "${PIZZAINC}/${PIZZAART}"
# ;;
# "-l" | "--heart")
# mail -s "${PIZZAUSER} sent you a Heart on ${PIZZAHOST}" $2 < "${PIZZAINC}/heart"
# ;;
# "-h" | "--help")
# help
# ;;
# *)
# echo "Unknown Argument!"
# help
# exit 100
# ;;
# esac
# fi
exit 0 exit 0