Below is my code implementation:
#!/bin/bash
DOM="onet.pl wp.pl"
for d in $DOM
do
echo -n "$d - "
whois $d | egrep -i 'Expiration|Expires on' | head -1
whois $d | egrep -i 'Expiration|Expires on' | head -1 >> /tmp/domain.date
echo ""
done
#[ -f /tmp/domain.date ] && mail -s 'Domain renew / expiration date' [email protected] < /tmp/domain.date || :
This code sends automatic mail when the domain expires. I’ve managed to code to show the expiration date and to send an email with an output. Can anyone tell me how to compare the expiration date with the current data which gives the result as a number of days?