#!/usr/bin/env bash json_escape_string() { local raw_value="${1}" raw_value="${raw_value//\\/\\\\}" raw_value="${raw_value//\"/\\\"}" raw_value="${raw_value//$'\n'/\\n}" raw_value="${raw_value//$'\r'/\\r}" raw_value="${raw_value//$'\t'/\\t}" printf '%s' "${raw_value}" } build_compose_files_json_array() { local compose_files_lines="${1}" local line="" local first=1 while IFS= read -r line; do if [ -z "${line}" ]; then continue fi if [ "${first}" -eq 1 ]; then printf ' "%s"' "${line}" first=0 else printf ',\n "%s"' "${line}" fi done <