Digging to the final IP

Dave Knight dave at knig.ht
Wed Oct 22 17:25:18 UTC 2014

On Oct 22, 2014, at 5:56, Niall O'Reilly <niall.oreilly at ucd.ie> wrote:

> At Tue, 21 Oct 2014 22:31:28 -0500,
> Frank Bulk wrote:
>> Dave,
>> Thanks for the input, but what I was looking for was a dig command that
>> returns the IP(s) or a fail.  It looks like the host command is the right
>> solution in this case, not dig.
>  Doesn't egrep fail on no match?

It does, but the cut at the end of the pipeline swallows it’s exit status

We can still get that though…

$ dig +noall +answer dave.knig.ht in a | egrep 'IN\tA\t' | cut -f6

$ echo ${PIPESTATUS[1]}

$ dig +noall +answer hopefully.this.does.not.exist in a | egrep 'IN\tA\t' | cut -f6

$ echo ${PIPESTATUS[1]}

That is if you’re using bash of course…

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20141022/3668141b/attachment.bin>

More information about the bind-users mailing list