Is there a way In bash to determine if a URL uses SSL? Before I send anything else to the URL I want to find out if it only accepts HTTP or HTTPS connections.
You can use the below script if you have access to wget.
#/bin/bash
URL=google.com
if wget --spider https://$URL 2>/dev/null; then
echo "https is present"
else
echo "https not present"
fi
Please note that you need to have http_proxy / https_proxy set.
I tested the above script in cygwin64 [dont have access to nix system as of now]
You should be also able to modify the same script using curl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With