参考脚本:
#set -x
cat /dev/null > record.txt
nmblookup \*|grep '<00>'|awk '{print $1}' >record.txt
#ping -c 2 -b 192.168.33.255|grep 64|awk '{print $4}'|sed -e 's/://g'>record.txt
. /etc/bashrc
NO=`cat record.txt|wc -l`
cat /dev/null > result
cat /dev/null > netbios_name
color black_green
cat <<EOF
################################
You will try $NO addresses
################################
EOF
#color black_white
echo "press return to continue"
read test
while read ip_addr
do
echo "We will try to test:$ip_addr"
###################################
nmblookup -A $ip_addr |grep '<00> - [B|M]'|awk '{print $1}' >>netbios_name
smbclient -I $ip_addr -M `nmblookup -A $ip_addr |grep '<00> - [B|M]'|awk '{print $1}'` << EOF
###############
[=^T^=]
###############
EOF
done < record.txt