Better fix for when line is empty

This commit is contained in:
mckmonster 2022-09-14 18:28:32 +02:00
parent 2b97e1f19d
commit 6d6853e95b

View file

@ -25,9 +25,6 @@ check(){
host="${2}" host="${2}"
name="${3}" name="${3}"
expectedcode="${4}" expectedcode="${4}"
if test -z ${ctype}
then return
fi
IPv="$(echo "${ctype}" | grep -o '[46]$')" IPv="$(echo "${ctype}" | grep -o '[46]$')"
case "${ctype}" in case "${ctype}" in
@ -62,6 +59,9 @@ command_exists 'ping'
mkdir -p "${tmp}/ok" "${tmp}/ko" || exit 1 mkdir -p "${tmp}/ok" "${tmp}/ko" || exit 1
while IFS="$(printf '\n')" read -r line; do while IFS="$(printf '\n')" read -r line; do
if test -z ${line}
then continue
fi
ctype="$(get_element 1 "${line}")" ctype="$(get_element 1 "${line}")"
code="$(get_element 2 "${line}")" code="$(get_element 2 "${line}")"
name="$(get_element 3 "${line}")" name="$(get_element 3 "${line}")"