Type Functions
inArray
Check if an element exists in an array
Usage
inArray element [ arrayElement0 arrayElement1 ... ]
Check if an element exists in an array
Return Code: 0 - If element is found in array Return Code: 1 - If element is NOT found in array Without arguments, displays help.
Arguments
element- Thing to search forarrayElement0- One or more array elements to match
Examples
if inArray "$thing" "${things[@]}"; then
things+=("$thing")
fi
Return codes
0- Success1- Environment error2- Argument error
isUnsignedNumber
Test if an argument is a positive floating point number
Usage
isUnsignedNumber
Test if an argument is a positive floating point number
(1e3 notation NOT supported)
Return Code: 0 - if it is a number equal to or greater than zero Return Code: 1 - if it is not a number equal to or greater than zero
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
Credits
Thanks to F. Hauri - Give Up GitHub (isnum_Case) .
isNumber
Test if an argument is a floating point number
Usage
isNumber
Test if an argument is a floating point number
(1e3 notation NOT supported)
Return Code: 0 - if it is a floating point number Return Code: 1 - if it is not a floating point number
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
Credits
Thanks to F. Hauri - Give Up GitHub (isnum_Case) .
isInteger
Test if an argument is a signed integer
Usage
isInteger [ value ]
Test if an argument is a signed integer
Return Code: 0 - if it is a signed integer Return Code: 1 - if it is not a signed integer
Arguments
value- EmptyString. The value to test.
Return codes
0- Success1- Environment error2- Argument error
Credits
Thanks to F. Hauri - Give Up GitHub (isuint_Case) .
isUnsignedInteger
Test if an argument is an unsigned integer
Usage
isUnsignedInteger argument ...
Test if an argument is an unsigned integer Return Code: 0 - if it is an unsigned integer Return Code: 1 - if it is not an unsigned integer
Arguments
value- EmptyString. Value to test if it is an unsigned integer.
Return codes
0- Success1- Environment error2- Argument error
Requires
returnMessage
Credits
Thanks to F. Hauri - Give Up GitHub (isnum_Case) .
isPositiveInteger
Test if an argument is a positive integer (non-zero)
Usage
isPositiveInteger value
Test if an argument is a positive integer (non-zero) Takes one argument only. Return Code: 0 - if it is a positive integer Return Code: 1 - if it is not a positive integer
Arguments
value- EmptyString. Required. Value to check if it is an unsigned integer
Return codes
0- Success1- Environment error2- Argument error
Requires
catchArgument isUnsignedInteger usageDocument
isNumber
Test if an argument is a floating point number
Usage
isNumber
Test if an argument is a floating point number
(1e3 notation NOT supported)
Return Code: 0 - if it is a floating point number Return Code: 1 - if it is not a floating point number
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
Credits
Thanks to F. Hauri - Give Up GitHub (isnum_Case) .
isFunction
Test if argument are bash functions
Usage
isFunction string
Test if argument are bash functions If no arguments are passed, returns exit code 1. Return Code: 0 - argument is bash function Return Code: 1 - argument is not a bash function
Arguments
string- Required. String to test if it is a bash function. Builtins are supported..is explicitly not supported to disambiguate it from the current directory..
Return codes
0- Success1- Environment error2- Argument error
Requires
catchArgument isUnsignedInteger usageDocument type
isExecutable
Test if all arguments are executable binaries
Usage
isExecutable string0 [ string1 ... ]
Test if all arguments are executable binaries If no arguments are passed, returns exit code 1. Return Code: 0 - All arguments are executable binaries Return Code: 1 - One or or more arguments are not executable binaries
Arguments
string- Required. Path to binary to test if it is executable.
Return codes
0- Success1- Environment error2- Argument error
Requires
throwArgument __help which
isCallable
Test if all arguments are callable as a command
Usage
isCallable string
Test if all arguments are callable as a command If no arguments are passed, returns exit code 1. Return Code: 0 - All arguments are callable as a command Return Code: 1 - One or or more arguments are callable as a command
Arguments
string- Required. EmptyString. Path to binary to test if it is executable.
Return codes
0- Success1- Environment error2- Argument error
Requires
throwArgument __help isExecutable isFunction
isTrue
True-ish
Usage
isTrue [ --help ] [ value ... ]
True-ish Succeeds when all arguments are "true"-ish
Arguments
--help- Optional. Flag. Display this help.value ...- EmptyString. One or more values to test.
Return codes
0- Success1- Environment error2- Argument error
isType
Bash types beyond
type -t
Usage
isType
Bash types beyond type -t
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
isArray
Is a variable declared as an array?
Usage
isArray variableName
Is a variable declared as an array?
Arguments
variableName- Required. String. Variable to check is an array.
Return codes
0- Success1- Environment error2- Argument error