Check for a valid name

This commit is contained in:
Bob Mottram 2015-12-01 09:25:05 +00:00
parent 7b6ef9755f
commit 1869a09ebf
1 changed files with 10 additions and 2 deletions

View File

@ -1104,7 +1104,8 @@ function interactive_configuration {
fi
if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
while [ ! $MY_NAME ]
valid_name=
while [ ! $valid_name ]
do
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
@ -1112,7 +1113,14 @@ function interactive_configuration {
--inputbox $"Your full name (or nick)" 10 30 "$(grep 'MY_NAME' temp.cfg | awk -F '=' '{print $2}')" 2> $data
sel=$?
case $sel in
0) MY_NAME=$(cat $data);;
0) possible_name=$(cat $data)
if [ "$possible_name" ]; then
if [ ${#possible_name} -gt 1 ]; then
valid_name="$possible_name"
MY_NAME="$possible_name"
fi
fi
;;
1) exit 1;;
255) exit 1;;
esac