INNER CODE UNIT · Shell

posix_regex

bitnami/containers · bitnami/activemq/6.3/debian-12/prebuildfs/opt/bitnami/scripts/libfile.sh:28

    local posix_regex=${4:-true}

    local result

    # We should avoid using 'sed in-place' substitutions
    # 1) They are not compatible with files mounted from ConfigMap(s)
    # 2) We found incompatibility issues with Debian10 and "in-place" substitutions
    local -r del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues
    if [[ $posix_regex = true ]]; then
        result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")"
    else
        result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")"
    fi
    echo "$result" > "$filename"
}

########################
# Replace a regex-matching multiline string in a file

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…