From 16a717a8bba7d51d4a607e8b8764e1143c46f264 Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 13 Nov 2016 15:49:40 +0100 Subject: [PATCH] Fixed debug trapError show warnings in IsNumeric functions when not numeric --- dev/ofunctions.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index c2ad5f1..3a00dfb 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -1,6 +1,6 @@ #### MINIMAL-FUNCTION-SET BEGIN #### -## FUNC_BUILD=2016111201 +## FUNC_BUILD=2016111301 ## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## To use in a program, define the following variables: @@ -801,10 +801,10 @@ function IsNumericExpand { local re="^-?[0-9]+([.][0-9]+)?$" - if [[ $value =~ $re ]]; then - echo 1 && return 1 + if [[ $value =~ ^-?[0-9]+([.][0-9]+)?$ ]]; then + echo 1 else - echo 0 && return 0 + echo 0 fi } @@ -813,9 +813,9 @@ function IsNumeric { local value="${1}" if [[ $value =~ ^[0-9]+([.][0-9]+)?$ ]]; then - echo 1 && return 1 + echo 1 else - echo 0 && return 0 + echo 0 fi } @@ -823,9 +823,9 @@ function IsInteger { local value="${1}" if [[ $value =~ ^[0-9]+$ ]]; then - echo 1 && return 1 + echo 1 else - echo 0 && return 0 + echo 0 fi }