mirror of
https://github.com/ivanilves/xiringuito.git
synced 2025-05-18 08:10:23 -07:00
Guard against zero value
This commit is contained in:
parent
253a6f830a
commit
67bc01e9c5
@ -42,8 +42,12 @@ while getopts "f:RDrh" o; do
|
|||||||
case ${o} in
|
case ${o} in
|
||||||
f)
|
f)
|
||||||
MAX_FAILED_PINGS=${OPTARG}
|
MAX_FAILED_PINGS=${OPTARG}
|
||||||
if [[ ! ${MAX_FAILED_PINGS} =~ [0-9]{1,} ]]; then
|
if [[ ! ${MAX_FAILED_PINGS} =~ ^[0-9]{1,}$ ]]; then
|
||||||
echo "'-f' option accepts only integer values"
|
echo "'-f' option accepts only positive integer values"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ ${MAX_FAILED_PINGS} -eq 0 ]]; then
|
||||||
|
echo "'-f' option value should be greater then zero"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user