1
#!/bin/bash
echo -n "Enter the domain name > "
read name
dig -t ns "$name" | cut -d ";" -f3 | cut -d ":" -f2| grep ns | cut -f6 > registerfile.txt;
cat registerfile.txt | while read line; do dig axfr "@$line" "$name"; done | cut -d"." -f-4 > nmap.txt
直到本節完成。下面,它可能與行和名稱參數不匹配。應該如何改變?bash上的邏輯方法
cat nmap.txt | while read line; do if [ "$line" == "$name" ]; then host "$line"; fi; done > ping.txt
cat ping.txt | cut -d " " -f4 | while read line; do if [[ "$line" =~ ^[0-9]+$ ]]; then nmap -sS "$line";fi ;done
'如果[「$ line ==」$ name「];'你在'$ line'中缺少''' – iamauser
謝謝,還有一個問題:cat nmap.txt |而讀線;如果[「$ line」==「$ name」];然後主機「$行」;網絡連接; done> ping.txt不工作,也就是說不會給出任何邏輯錯誤,但是,如何糾正邏輯方法? – user1532437
你可能想對[cat'](http://www.iki.fi/era/unix/award.html)這些[無用的用法]做點事情。 – tripleee