I'm not convinced the exit code can be handled how you want it. A lookup that returns NXDOMAIN was a successful lookup, so IMO shouldn't return an exit code of non-zero.
is this not a valid work around for what you want? dig www.google.com | grep NOERROR 1>/dev/null && echo SUCCESS || echo FAILURE ** Changed in: bind9 (Ubuntu) Importance: Undecided => Wishlist ** Changed in: bind9 (Ubuntu) Status: New => Incomplete -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to bind9 in Ubuntu. https://bugs.launchpad.net/bugs/854705 Title: dig returns 0 regardless of result of query To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/bind9/+bug/854705/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs