I have been trying to get my small bash script working for the past few days, so that I can import a list of domains from a text file and loop it into an if statement with the openssl commands. Any ideas what I am doing wrong here, when run it looks like its not passing the text file into the loop. Was trying a while statement with limited success. Thank you for the help!
#!/bin/bash
#IP Range to test for expired certificates
for SITE in $(cat host.txt);
do
# Openssl Test and Parse Results, match against expired certificate presented
  if [[ $(echo | timeout 1 openssl s_client -connect $SITE:443 2>&1  | sed -ne '/certificate 
       has expired/p') ]]; then
  echo "$SITE Certificate Expiration Error" >> out.txt
  timeout 1 openssl s_client -connect $SITE:443 2>&1 | sed -ne '/subject=/,/issuer=/p' >> 
  out.txt
  else
    echo $SITE "Certificate not expired"
  fi
done
 
    