mirror of
https://github.com/ivanilves/xiringuito.git
synced 2025-05-18 00:00:18 -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
|
||||
f)
|
||||
MAX_FAILED_PINGS=${OPTARG}
|
||||
if [[ ! ${MAX_FAILED_PINGS} =~ [0-9]{1,} ]]; then
|
||||
echo "'-f' option accepts only integer values"
|
||||
if [[ ! ${MAX_FAILED_PINGS} =~ ^[0-9]{1,}$ ]]; then
|
||||
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
|
||||
fi
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user