#!/usr/bin/env sh set -eu url="${1:-https://example.com/}" printf '== first request == '; curl -sS -D /tmp/headers-one -o /dev/null "$url"; grep -Ei '^(cache-control|etag|last-modified|vary|age):' /tmp/headers-one || true etag=$(awk 'tolower($1)=="etag:"{$1="";sub(/^ /,"");gsub(/ /,"");print}' /tmp/headers-one) [ -z "$etag" ] || curl -sS -o /dev/null -D - -H "If-None-Match: $etag" "$url" | head -n 1