mirror of https://github.com/dirtbags/moth.git
41 lines
753 B
Bash
Executable File
41 lines
753 B
Bash
Executable File
#! /bin/sh -e
|
|
|
|
fail () {
|
|
echo "$@" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
case "$ACTION:$CAT:$POINTS" in
|
|
inventory::)
|
|
cat <<EOT
|
|
{
|
|
"pategory": [1, 2, 3, 4, 5, 10, 20, 300],
|
|
"nealegory": [1, 3, 2]
|
|
}
|
|
EOT
|
|
;;
|
|
open:*:*)
|
|
case "$CAT:$POINTS:$FILENAME" in
|
|
*:*:moo.txt)
|
|
echo "Moo."
|
|
;;
|
|
*)
|
|
fail "Cannot open: $FILENAME"
|
|
;;
|
|
esac
|
|
;;
|
|
answer:pategory:1)
|
|
if [ "$ANSWER" = "answer" ]; then
|
|
echo '{"Correct":true}'
|
|
else
|
|
echo '{"Correct":false}'
|
|
fi
|
|
;;
|
|
answer:pategory:2)
|
|
fail "Internal error"
|
|
;;
|
|
*)
|
|
fail "ERROR: Unknown action: $action"
|
|
;;
|
|
esac
|