Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
korinf
etersoft-build-utils
Commits
084b3d06
Commit
084b3d06
authored
5 years ago
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add isnumber function
parent
8667dee5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
strings
share/eterbuild/functions/strings
+7
-0
test_isnumber.sh
tests/test_isnumber.sh
+7
-7
No files found.
share/eterbuild/functions/strings
View file @
084b3d06
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
tests/test_isnumber.sh
View file @
084b3d06
#!/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
()
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment