#!/bin/bash
# http://stackoverflow.com/questions/13127352/checking-alternative-names-for-a-san-ssl-cert
echo "quit" | openssl s_client -connect $1:443 | openssl x509 -noout -text | grep "DNS:" | perl -pe "s/(, )?DNS:/\n/g"


syntax highlighted by Code2HTML, v. 0.9.1