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 {
|
||||
local f_num
|
||||
for f_num in $@
|
||||
local f_arg=( "0" "$@" )
|
||||
for (( i=0; i<=$#; i++ ))
|
||||
do
|
||||
if ! [[ ${f_num} =~ ^(-)?(\.)?[0-9]+(\.[0-9]+)?$ ]]
|
||||
if ! [[ ${f_arg[$i]} =~ ^(-)?(\.)?[0-9]+(\.)?([0-9]+)?$ ]]
|
||||
then
|
||||
echo "\"${f_num}\": Not a valid number" 1>&2
|
||||
echo "\"${f_arg[$i]}\": Not a valid number" 1>&2
|
||||
g_traceback
|
||||
return 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user