Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Comment this if statement if you don't want to clean address file each time
- if [ -s addresses.txt ]
- then
- rm -f addresses.txt
- touch addresses.txt
- fi
- while read line
- do
- result=$(dig "$line" +short)
- if [ -n "$result" ];
- then
- echo "$result" >> addresses.txt
- echo "$result"
- else
- echo "$line" >> addresses.txt
- echo "$line"
- fi
- done < hostnames.txt
- # Comment these lines if you don't want to clean hostname file each time
- rm -f hostnames.txt
- touch hostnames.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement