#!/bin/bash which whois >/dev/null || { echo "whois - not installed"; exit 1; } [ -z "${1}" ] && { echo "domain - not spicified"; exit 1; } now=$(date '+%s') expiration_date=$(date -d "$(whois "${1}" | grep 'Registry Expiry Date'|awk -F ': ' '{print $2}')" '+%s') echo $(( ( expiration_date - now )/(60*60*24) ))