0

When I do: dig -x +short I get only the hosts output, but when doing dig -x <ip> +short > file.txt I get all the rubbish, as if it was not executed with +short.

I have tried:

dig -x <ip> +short 2>&1 > file.txt

also

dig -x <ip> +short 2>/dev/null > file.txt

But didn't work, Thank you

aDoN
  • 1,877
  • 4
  • 39
  • 55

1 Answers1

0

As @anubhava observed in a comment, ordering matters:

dig +short -x "$ip"
Community
  • 1
  • 1
Charles Duffy
  • 280,126
  • 43
  • 390
  • 441