vendredi 27 août 2021

checking a string in bash to see if its a domain

I am working on a project in Bash that takes a live xlsx file, converts it into a csv file, and checks the file to make sure that the data inside it are urls. This is part of a larger progragam that will eventually test each url for domain squatting.

I am having problems with the verification of the string data. I am having to teach myself bash as i go along since this is a self study class. Thanks for the Help!

INPUT=domain3.csv 
while IFS= read -r line
do
   if [[ "$line" == *".com"*] || [ "$line" == *".net"*] || [ "$line" == *".org"*] || [ "$line" == *".biz"*]];
   
   then echo "$line"

    else echo "$line is not an URL"
   fi
    echo "Finished!"
done

Aucun commentaire:

Enregistrer un commentaire