anyterm-cmd: Exit loop on empty username.

This commit is contained in:
Alexander Boström 2012-05-22 12:26:59 +02:00
commit 5a7b652e2d

View file

@ -8,6 +8,10 @@ set -eo pipefail
while : ; do
echo -n "Username: "
read U
if [[ -z "$U" ]]; then
echo "Disconnecting."
exit
fi
# Make sure it does not start with a "-" and only contains valid
# username characters.
if [[ "$U" =~ ^[A-Za-z0-9_][A-Za-z0-9_-]*$ ]]; then