#!/bin/sh # Registration expiry date of a domain command -v whois > /dev/null 2>&1 || { echo "whois not found" >&2; exit 1; } DOMAIN="example.com" raw_date="$(whois "$DOMAIN" | grep -i -m1 -E "expir(y|ation) date" | cut -d: -f2- | sed 's/^ *//')" date -d "$raw_date" +%Y-%m-%d