gaboshlib/g_num_valid_number.sh aktualisiert
This commit is contained in:
parent
44b71f5f3b
commit
2c2803a27b
@ -1,10 +1,10 @@
|
|||||||
function g_num_valid_number {
|
function g_num_valid_number {
|
||||||
local f_num
|
local f_arg=( "0" "$@" )
|
||||||
for f_num in $@
|
for (( i=0; i<=$#; i++ ))
|
||||||
do
|
do
|
||||||
if ! [[ ${f_num} =~ ^(-)?(\.)?[0-9]+(\.[0-9]+)?$ ]]
|
if ! [[ ${f_arg[$i]} =~ ^(-)?(\.)?[0-9]+(\.)?([0-9]+)?$ ]]
|
||||||
then
|
then
|
||||||
echo "\"${f_num}\": Not a valid number" 1>&2
|
echo "\"${f_arg[$i]}\": Not a valid number" 1>&2
|
||||||
g_traceback
|
g_traceback
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user