Dennis de Booij
dennisdebooij.bsky.social
Dennis de Booij
@dennisdebooij.bsky.social
.
Congrats!
January 17, 2025 at 11:25 AM
Maybe this? curl -s -I <URL> | awk 'NR==1 {print $3}' | your-parser

1. -s: Silent mode to suppress unnecessary output.
2. -I: Fetches only the HTTP headers.
3. awk 'NR==1 {print $3}': Extracts the third field from the first line of the response headers, which is the status message
January 2, 2025 at 9:21 PM
If you specifically want the status message (e.g., "OK" for 200, "Not Found" for 404) instead of just the numeric status code, curl alone doesn't provide that directly. However, you can use curl with awk or other tools to parse it:

curl -s -I <URL> | awk 'NR==1 {print $2, $3}'
January 2, 2025 at 7:15 PM
curl -s -o /dev/null -w "%{http_code}\n" <URL>

-o /dev/null: Discards the response body.

-w "%{http_code}\n": Writes the HTTP status code.
January 2, 2025 at 7:14 PM
All the best, Lee. Sending a virtal bro hug ;)
a man standing in a kitchen with a fridge that has a sticker on it that says ' coca cola '
ALT: a man standing in a kitchen with a fridge that has a sticker on it that says ' coca cola '
media.tenor.com
December 22, 2024 at 6:34 PM
⬇️
a sloth is laying under a blanket on the floor
Alt: a sloth is laying under a blanket on the floor
media.tenor.com
November 19, 2024 at 12:39 PM
There's something strangely satisfying to be the one that periodically mutters 'Bloody testers'.
November 19, 2024 at 12:32 PM