Added equals() and contains()
This commit is contained in:
parent
3be55e2702
commit
e355cbe4ab
@ -6,6 +6,24 @@ source ./log_helpers
|
|||||||
if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
|
if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
|
||||||
readonly general_utils_sourced=${BASH_SOURCE[0]}
|
readonly general_utils_sourced=${BASH_SOURCE[0]}
|
||||||
|
|
||||||
|
# compare two strings
|
||||||
|
equal () {
|
||||||
|
case "$1" in
|
||||||
|
"$2")
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 1 # they don't match
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if second string is contained in first string
|
||||||
|
contains () {
|
||||||
|
if grep -qE "$2" <<< $1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1 # not contained
|
||||||
|
}
|
||||||
|
|
||||||
exec_process_substitution () {
|
exec_process_substitution () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
log_debug "$func:${LINENO} exec-ing [$*]"
|
log_debug "$func:${LINENO} exec-ing [$*]"
|
||||||
|
Loading…
Reference in New Issue
Block a user