Short mode

A common thing to want to do is to get one answer from one query, skipping the TTLs and Additional and Authoritative sections of the response.

In short mode, dog will do just that. Running dog in short mode does one of two things:

  1. If the response is received successfully, and there is more than one record in the Answer section, dog will print just the values to standard output, and return 0.
  2. If there is an error, or no records in the Answer section, dog will print the error to standard error, and return a non-zero exit status.

To run dog in short mode, pass the -1 or --short command-line option.

dog example.com --short

Examples

When a response contains one or more records, they get printed, one per line, to standard output.

$ dog dns.google --short
8.8.8.8
8.8.4.4
[Exit status 0]

When there are no results for the query, a message gets printed to standard error.

$ dog non-exist --short
No results
[Exit status 2]