#! /bin/sh -e # Change to CTF_BASE cd ${CTF_BASE:-.} for i in $(seq 5); do [ -f assigned.txt ] && break cd .. done if ! [ -f assigned.txt ]; then cat < Team Registration

Team Registration

EOF if [ -z "$hash" ] || [ -z "$team" ]; then echo "

Oops!

" echo "

Empty field, cannot complete request

" elif ! grep -q "^$hash$" assigned.txt; then echo "

Oops!

" echo "

That hash has not been assigned.

" elif [ -f state/teams/$hash ]; then echo "

Oops!

" echo "

That hash has already been registered.

" else printf "%s" "$team" > state/teams/$hash echo "

Success!

" echo "

Okay, your team has been named and you may begin using your hash!

" fi cat < EOF