Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
2 grammar/spelling
source | link

I've got a txt of a bunch of domains I need to run dig +short mx on.

I've got a script set to run the command, print it to a results.txt with:

./dig_domain_mx.sh > results.txt

Downside is, I need to be able to know which domains relate to each result, so my solution is to print the current line being read by the script, then print the dig output for the line, then add a linebreak.

I can't seem to find anything alluding to this being possible with dig commands alone, so how would I go about this within my Bash script?


Current Bash script, nothing special:

#!/bin/bash
dig -f domains.txt +short mx

I've got a txt of a bunch of domains I need to run dig +short mx on.

I've got a script set to run the command, print it to a results.txt with:

./dig_domain_mx.sh > results.txt

Downside is, I need to be able to know which domains relate to each result, so my solution is to print current line being read by the script, then print the dig output for the line, then add a linebreak.

I can't seem to find anything alluding this being possible with dig commands alone, so how would I go about this within my Bash script?


Current Bash script, nothing special:

#!/bin/bash
dig -f domains.txt +short mx

I've got a txt of a bunch of domains I need to run dig +short mx on.

I've got a script set to run the command, print it to a results.txt with:

./dig_domain_mx.sh > results.txt

Downside is, I need to be able to know which domains relate to each result, so my solution is to print the current line being read by the script, then print the dig output for the line, then add a linebreak.

I can't seem to find anything alluding to this being possible with dig commands alone, so how would I go about this within my Bash script?


Current Bash script, nothing special:

#!/bin/bash
dig -f domains.txt +short mx
1
source | link

Bash print current line, line's output, and linebreak to file

I've got a txt of a bunch of domains I need to run dig +short mx on.

I've got a script set to run the command, print it to a results.txt with:

./dig_domain_mx.sh > results.txt

Downside is, I need to be able to know which domains relate to each result, so my solution is to print current line being read by the script, then print the dig output for the line, then add a linebreak.

I can't seem to find anything alluding this being possible with dig commands alone, so how would I go about this within my Bash script?


Current Bash script, nothing special:

#!/bin/bash
dig -f domains.txt +short mx