Trying to build a shell script which determines if the site is using PulseVPN or not. The script takes a input file which contains a list of URLs, iterate each URL line by line, perform cURL operation and grep for specific string. And if string found, display a echo message "Website using PulseVPN"
Here is my code -
Keyword="dana-na" # keyword to find for PulseSecure SSL VPN
while read -r line;
do
if curl -s -L "$line" | grep "$keyword" > /dev/null
then
# if the keyword is in the conent
echo " The website $line is using Pulse Secure VPN"
else
echo "Pulse Secure VPN Not Found on $line"
fi
done < urls.txt
Problem The code is working but The problem here is when i include only one URL in input file. It gives correct result. But if i include more than one URL in input file, then it gives incorrect results. Can anyone explains why is this happening. Is anything wrong in code ?