mirror of https://github.com/lework/script
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
436 B
20 lines
436 B
5 years ago
|
is_int() { #? Check if value(s) is integer
|
||
|
local param
|
||
|
for param; do
|
||
|
if [[ ! $param =~ ^[\-]?[0-9]+$ ]]; then return 1; fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
is_float() { #? Check if value(s) is floating point
|
||
|
local param
|
||
|
for param; do
|
||
|
if [[ ! $param =~ ^[\-]?[0-9]*[,.][0-9]+$ ]]; then return 1; fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
is_hex() { #? Check if value(s) is hexadecimal
|
||
|
local param
|
||
|
for param; do
|
||
|
if [[ ! ${param//#/} =~ ^[0-9a-fA-F]*$ ]]; then return 1; fi
|
||
|
done
|
||
|
}
|