How can I get result of a dns mx record with nslookup
in a .sh
file that it would do all its steps automatically without questioning set type=mx
then domain. I just want execute ./file.sh
then it give me the result.
The bash file might be something like this:
#!/bin/bash
nslookup
set type=mx
example.com
But everytime I execute the file it just runs the first line nslookup
, and it requests set type=mx
and domain again.
I got my answer in stackoverflow in another way with using -q=mx
:
#!/bin/bash
nslookup -q=mx example.com
But I would like my answer to use set type=mx
Try this: