check_curl print

This commit is contained in:
Cyberes 2023-04-21 23:54:19 -06:00
parent 05892276bf
commit e119301f2b
1 changed files with 4 additions and 3 deletions

View File

@ -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