From e119301f2b8a3cffa8c40395483aadb6afa8a5f4 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Fri, 21 Apr 2023 23:54:19 -0600 Subject: [PATCH] check_curl print --- check_curl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/check_curl b/check_curl index 3b35893..9523f51 100755 --- a/check_curl +++ b/check_curl @@ -75,13 +75,14 @@ for value in "${values[@]}"; do HEADER_ARGS+=' -H "'$value'" ' done +TMP_ERROR_LOG=$(mktemp) +TMP_RESPONSE=$(mktemp) + if $PRINT_ONLY; then - echo "curl --output \"$TMP_RESPONSE\" -s -w \"%{http_code}\n%{time_total}\" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL" + printf "%s" "curl --output \"$TMP_RESPONSE\" -s -w \"%{http_code}\n%{time_total}\" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL" exit 3 fi -TMP_ERROR_LOG=$(mktemp) -TMP_RESPONSE=$(mktemp) RESPONSE=$(curl --output "$TMP_RESPONSE" -s -w "%{http_code}\n%{time_total}" $(echo "${HEADER_ARGS[@]}" | tr -s ' ') $FOLLOW_REDIRECTS $INSECURE $RESOLVE $URL 2>"$TMP_ERROR_LOG") # shellcheck disable=SC2181