I am trying to learn Bash scripting. This one performs Nominet whois lookups (checks the availability of .uk domains). Disclaimer: I don't know how well-formed it is - probably not very. Use at your own peril!
#!/bin/bash
clear; echo Checking domains
i=0;
for var in "$@"
do
tput sc; tput cup 0 0; echo ' '
tput cup 0 0; echo Checking $var
tput rc
whois $var.org.uk | grep "No match"
whois $var.co.uk | grep "No match"
let i++;
if [ $i == 2 ]; then
tput sc; tput cup 0 25; echo 'Waiting politely...'
sleep 1;
tput cup 0 25; echo ' '
tput rc
i=0;
fi
done
Syntax:
Sample output:
No match for "thisoneisnttaken.org.uk".
No match for "thisoneisnttaken.co.uk".
No match for "coaxed.org.uk".
No match for "coaxed.co.uk".
No match for "residual.org.uk".
No match for "braincheese.org.uk".
No match for "braincheese.co.uk".
No match for "meltface.org.uk".
The 'Waiting politely' part inserts a delay; Nominet allows up to 5 queries per second. However, you're only allowed 1,000 requests per day, so be careful. Read and understand Nominet's whois Acceptable Use Policy.

