[NTLUG:Discuss] Script for domain validation
Steve Southwell
ses at sagepost.com
Thu Apr 15 15:45:37 CDT 2004
The perl example works perfectly! Much thanks!
David Camm wrote:
> well. i'm not a shell expert, but i would think that the first
> statement ends with echo "bad" because there's a ';' after it then the
> next command is an unconditional exit 1.
>
> could that be the problem?
>
> again, not being a shell person - could you do this:
>
> || (echo....; exit);
>
> david camm
> advanced web systems
>
> ps - here's now to do it in perl:
>
> #!/usr/bin/perl
> $result = `host $ARGV[0]`;
> if ($result =~ / has address /) {print "Good\n"; exit (0);}
> print "Bad\n";
> exit 1;
>
>
>
> Steve Southwell wrote:
>
>> I've just about got a script working, and what I want it to do is
>> simply validate that a given domain exists. (It's part of an email
>> address validation routine)
>>
>> I'm just about brain dead this afternoon - can anyone tell my why
>> this doesn't work, and perhaps suggest a fix:
>>
>> host $1 | grep " has address " &> /dev/null || echo "Bad"; exit 1
>> echo "Good"; exit 0
>>
>> what happens is that it correctly handles the "Bad" case, but doesn't
>> handle the good case.
>>
>
>
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
--
Steve Southwell 214-488-2239 (Voice)
President / CEO 214-280-6439 (Mobile)
SagePost, Inc. http://www.sagepost.com
Internet Data Services Provider
More information about the Discuss
mailing list