projects
/
BK-2020-03.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix(user/):Fix flac converter script
[BK-2020-03.git]
/
unitproc
/
bktemp-checkFlt
diff --git
a/unitproc/bktemp-checkFlt
b/unitproc/bktemp-checkFlt
index 530ff0e48e82de964dd63c47e157a679e3311bf1..0a0d6e41e3b0014a8a1332a2f9e8ea332479f8ef 100644
(file)
--- a/
unitproc/bktemp-checkFlt
+++ b/
unitproc/bktemp-checkFlt
@@
-8,12
+8,12
@@
die() { yell "$*"; exit 111; } # same as yell() but non-zero exit status
try() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
checkFlt() {
# Desc: Checks if arg is a float
try() { "$@" || die "cannot $*"; } # runs args as command, reports args if command fails
checkFlt() {
# Desc: Checks if arg is a float
- # Usage: check
In
t arg
+ # Usage: check
Fl
t arg
# Input: arg: float
# Output: - return code 0 (if arg is float)
# - return code 1 (if arg is not float)
# Input: arg: float
# Output: - return code 0 (if arg is float)
# - return code 1 (if arg is not float)
- # Example: if ! check
In
t $arg; then echo "not flt"; fi;
- # Version: 0.0.
1
+ # Example: if ! check
Fl
t $arg; then echo "not flt"; fi;
+ # Version: 0.0.
2
# Depends: yell(), die(), bash 5.0.3
# Ref/Attrib: JDB https://stackoverflow.com/a/12643073 float regex
local returnState
# Depends: yell(), die(), bash 5.0.3
# Ref/Attrib: JDB https://stackoverflow.com/a/12643073 float regex
local returnState
@@
-36,7
+36,7
@@
checkFlt() {
else
return 1;
fi;
else
return 1;
fi;
-} # Checks if arg is
integer
+} # Checks if arg is
float
#===END Declare local script functions===
#==END Define script parameters==
#===END Declare local script functions===
#==END Define script parameters==
@@
-74,6
+74,9
@@
myVar1="foo"; echo "Test 10:Should fail because floats should only contain numbe
myVar1="foo"; myVar2="bar"; myVar3="baz"; echo "Test 11: Should fail because multiple arguments provided.";
(if checkFlt "$myVar1" "$myVar2" "$myVar3"; then yell "success"; else yell "fail"; fi;) & sleep 1;
myVar1="foo"; myVar2="bar"; myVar3="baz"; echo "Test 11: Should fail because multiple arguments provided.";
(if checkFlt "$myVar1" "$myVar2" "$myVar3"; then yell "success"; else yell "fail"; fi;) & sleep 1;
+
+myVar1=""; echo "Test 12: Should fil because empty string.";
+(if checkFlt "$myVar1"; then yell "success"; else yell "fail"; fi;) & sleep 1;
#==END test code==
# Author: Steven Baltakatei Sandoval
#==END test code==
# Author: Steven Baltakatei Sandoval