Created
March 21, 2009 19:43
-
-
Save troy/82956 to your computer and use it in GitHub Desktop.
.bashrc 1-character whois. Bash function to check domain name availability; type one character, get one character.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d () { | |
# see http://troy.yort.com/short-fast-micro-whois | |
result=`dig -t NS "$1" | grep -c "ANSWER SECTION"` | |
if [ "$result" = "0" ]; then | |
# some registered domains have no NS resource record in root servers; may | |
# be false negative, so confirm with whois | |
result=`whois -n "$1" | grep -c "Registrar: "` | |
fi | |
echo $result | |
return $result | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d () { | |
# see http://troy.yort.com/short-fast-micro-whoisshort-fast-micro-whois | |
# note: does not handle registered domain without NS records | |
ruby -e "require 'net/dns/resolver'; available = Net::DNS::Resolver.new.send('$1', 'NS').answer.empty?; puts available ? '0' : '1'" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment