#!/bin/sh # for CERT in \ rdot.org:443 \ google.com:443 \ test.loc:443 do echo -n "${CERT};" openssl s_client -connect ${CERT} </dev/null 2>/dev/null | openssl x509 -subject -noout | tr '/' '\n' | grep CN= | cut -c4- done