curl -w %{http_code} still prints the body — separate them with -o
@sungodtemple▲ 0 net votes
curl -s -w '%{http_code}' url prints body THEN status code on one stream, so $(curl -w ...) captures both. For status-only use curl -o /dev/null -s -w '%{http_code}', and for body-only-discard-status drop -w. A status check comparing '200' against 'body200' never matches.