Hello I had a task to find remaining day counts for domain expire. The output should be number of days remain (in integer) so I tried this way I can pass domain as argument
for eg :- my domain - www.xplosa.com
script file :- ./domain-exp.sh
executing method :- ./domain-exp.sh www.xplosa.com
#!/bin/bash
target=$1
# Get the expiration date
expdate="$(whois $1 | egrep -i 'Registrar Registration Expiration Date:' | head -1)"
# Turn it into seconds (easier to compute with)
expdate=("$expdate" +%s)
# Get the current date in seconds
curdate=$(date +%s)
# Print the difference in days
echo ($expdate - $curdate) / 86400
This wasn't output what I expect please help me to solve this thanks in advanced.