You are not logged in.
Hey guys!
I am using a script to check for free domain names. I got it from 'linuxconfig.org'. It's named 'domain'.
cat /usr/local/bin/domain
#!/bin/bash
# Name: Check for domain name availability
# linuxconfig.org
# Please copy, share, redistribute and improve
if [ "$#" == "0" ]; then
echo "You need to supply at least one argument!"
exit 1
fi
DOMAINS=( '.com' '.net' '.info' \
'.org' '.pro' )
ELEMENTS=${#DOMAINS[@]}
while (( "$#" )); do
for (( i=0;i<$ELEMENTS;i++)); do
whois $1${DOMAINS[${i}]} | egrep -q \
'^No match|^NOT FOUND'
if [ $? -eq 0 ]; then
echo "$1${DOMAINS[${i}]} : available"
fi
done
shift
doneIt was working till the last time I used it. Now it gives
domain gooogl
fgets: Connection reset by peer
gooogl.net : available
gooogl.pro : availableWhat could be the most possible reason for that?
Last edited by amaro (2017-12-17 17:12:41)
Offline
No idea what all those bashism do, but this script is way to large for what it does.
#!/usr/bin/bash
for domain in com net info org pro; do
if ! whois ${1}.$domain >> /dev/null; then
echo "${1}.$domain available"
fi
donedoes the same and works fine for me. It seems that whois sets the return code to 1 if it can't find the domain, but you allways can add your grep for "No match" or whatever..
Also I somtimes get the "fgets: Connection reset by peer" error randomly. And whois servers usually only allow a certain amount of queries per time.
Offline
I tested your script and got no error.
Thank you, null!
Offline