Added equals() and contains()

This commit is contained in:
Gerhard Hoffmann 2022-06-03 21:44:41 +02:00
parent 3be55e2702
commit e355cbe4ab

View File

@ -6,6 +6,24 @@ source ./log_helpers
if [ "${general_utils_sourced:-1}" = "1" ]; then # include only once
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 () {
local func="${FUNCNAME[0]}"
log_debug "$func:${LINENO} exec-ing [$*]"