#! /bin/sh : ${CTF_BASE:=/var/lib/ctf} BASE=$CTF_BASE/teams esc () { printf '%s' "$*" | sed 's/[^-0-9A-Za-z ]/_/g; s/ /+/g' } newteam () { echo '== Team Creation ==' echo echo -n 'What would you like your team to be called (3-12 chars)? ' read -r name echo namelen=$(printf "%s" "$name" | wc -c) if [ $namelen -lt 3 ] || [ $namelen -gt 12 ]; then echo 'Invalid name length' return fi hash=$(printf '%s %s' "$salt" "$name" | md5sum | cut -b 1-8) if [ -f $BASE/names/$hash ]; then echo "That name is already in use. Try another one." return fi printf '%s' "$name" > $BASE/names/$hash cat < " read -r answer case "$answer" in \?|help) cat <