Added equals() and contains()
This commit is contained in:
		@@ -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 [$*]"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user