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