slash check added

This commit is contained in:
Barry McCormick
2023-10-17 12:35:25 -07:00
parent 10949c0eeb
commit 0065a6b9f0

View File

@@ -82,6 +82,11 @@ validate_ip() {
else
local IFS
if echo "${ip}" | grep -Eq '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))?$'; then
CHARACTER="/"
TEST_SLASH=$(echo "${ip}"
if echo $TEST_SLASH | grep -q "$CHARACTER"
else
exit 1
TEST_MASK=$(echo "${ip}" | cut -d / -f2)
if TEST_MASK=""
echo "missing netmask"