2020-08-27 19:29:54 -06:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
2020-08-28 14:05:32 -06:00
|
|
|
fail () {
|
|
|
|
echo "$@" 1>&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$ACTION:$CAT:$POINTS" in
|
|
|
|
inventory::)
|
|
|
|
echo "pategory 1 2 3 4 5 10 20 300"
|
|
|
|
echo "nealegory 1 3 2"
|
|
|
|
;;
|
|
|
|
open:*:*)
|
|
|
|
case "$CAT:$POINTS:$FILENAME" in
|
|
|
|
*:*:moo.txt)
|
|
|
|
echo "Moo."
|
2020-08-27 19:29:54 -06:00
|
|
|
;;
|
|
|
|
*)
|
2020-08-28 14:05:32 -06:00
|
|
|
fail "Cannot open: $FILENAME"
|
2020-08-27 19:29:54 -06:00
|
|
|
;;
|
2020-08-28 14:05:32 -06:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
answer:pategory:1)
|
|
|
|
if [ "$ANSWER" = "answer" ]; then
|
|
|
|
echo "correct"
|
|
|
|
else
|
|
|
|
echo "Sorry, wrong answer."
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
answer:pategory:2)
|
|
|
|
fail "Internal error"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
fail "ERROR: Unknown action: $action"
|
|
|
|
;;
|
2020-08-27 19:29:54 -06:00
|
|
|
esac
|