Commit 084b3d06 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add isnumber function

parent 8667dee5
......@@ -3,6 +3,7 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
filter_strip_spaces()
{
# possible use just
......@@ -11,6 +12,12 @@ filter_strip_spaces()
sed -e "s|^ ||" | sed -e "s| \$||"
}
# TODO: see etersoft-build-utils/tests/test_isnumber.sh
isnumber()
{
echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
}
strip_spaces()
{
echo "$*" | filter_strip_spaces
......
#!/bin/sh
. `dirname $0`/../share/eterbuild/functions/common
#load_mod spec
load_mod strings
check()
{
......@@ -9,12 +9,12 @@ check()
}
# TODO: move to lib
isnumber()
{
#local num="$(("$*"))"
echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
#[ "$num" != "0" ]
}
#isnumber()
#{
# #local num="$(("$*"))"
# echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
# #[ "$num" != "0" ]
#}
check_arg()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment