bulk-nslookup.sh
· 327 B · Bash
Surowy
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <file>"
exit 1
fi
input_file="$1"
if [ ! -f "$input_file" ]; then
echo "File not found: $input_file"
exit 1
fi
while IFS= read -r ip_address; do
echo "Performing nslookup for $ip_address"
nslookup "$ip_address"
echo "-----"
done < "$input_file"
1 | #!/bin/bash |
2 | |
3 | if [ $# -ne 1 ]; then |
4 | echo "Usage: $0 <file>" |
5 | exit 1 |
6 | fi |
7 | |
8 | input_file="$1" |
9 | |
10 | if [ ! -f "$input_file" ]; then |
11 | echo "File not found: $input_file" |
12 | exit 1 |
13 | fi |
14 | |
15 | while IFS= read -r ip_address; do |
16 | echo "Performing nslookup for $ip_address" |
17 | nslookup "$ip_address" |
18 | echo "-----" |
19 | done < "$input_file" |
20 |