#!/usr/bin/env bash # # Checks if the specific domain is available domain=$1 check=$(whois -h whois.nic.ch -p 4343 $domain | head -1 | awk -F':' {'print $1'}) case "$check" in 0) # already registered ;; 1) echo "free!" | mail -s "$domain is free!" oli@lugh.ch ;; *) echo "unhandled, see https://www.nic.ch/reg/cm/wcm-page/faqs/technical/whoisis.jsp" ;; esac