Domain Availability from Shell

December 14th, 2006

Example of usage:

[~]$ ava oohay fursplash.{net,org} waking{,-}beast{,.net}
- oohay.com
+ fursplash.net
- fursplash.org
+ wakingbeast.com
+ wakingbeast.net
+ waking-beast.com
+ waking-beast.net

The code below assumes that you have whois program in your PATH.

    1 #!/usr/bin/env ruby -w
    2 
    3 if ARGV.empty?
    4   puts <<-T
    5 domain availability checker by dairon
    6 usage: ava <url[.com]>...
    7   T
    8   exit
    9 end
   10 
   11 ARGV.each do |d|
   12   res, domain = "-", d
   13   domain += ".com" unless domain.include?(".")
   14   whois = `whois #{domain}`
   15   res = "+" if whois.include?( "No match" )
   16   puts "#{res} #{domain}"
   17 end