Code to hopefully avoid existing entries.
This commit is contained in:
parent
194aa901bf
commit
f99d620b21
12
tojam
12
tojam
@ -48,9 +48,19 @@ add_server() {
|
||||
valid="false"
|
||||
fi
|
||||
if ! [[ "${serverInfo[2]}" =~ ^[1-9][0-9]*$ ]]; then
|
||||
errorMessage+="Port must be numeric."
|
||||
errorMessage+="Port must be numeric.\n"
|
||||
valid="false"
|
||||
fi
|
||||
for i in "${!servers[@]}" ; do
|
||||
if [[ "$i" == "${serverInfo[0]}" ]]; then
|
||||
errorMessage+="Server name \"$i\" is already in use.\n"
|
||||
valid="false"
|
||||
fi
|
||||
if [[ "${servers[${i}]}" == "${serverInfo[1]}" ]]; then
|
||||
errorMessage+="Server address \"$i\" is already added.\n"
|
||||
valid="false"
|
||||
fi
|
||||
done
|
||||
if [[ "${valid}" == "false" ]]; then
|
||||
dialog --backtitle "Tojam" \
|
||||
--msgbox "${errorMessage}" -1 -1
|
||||
|
Loading…
Reference in New Issue
Block a user