下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
#!/bin/bash function err(){ if [ $? == 1 ];then echo " **" fi } if [ $# -eq 0 ]; then defnet="wlan0" else [email protected] fi for i in $defnet do echo -e "\033[42;37;5m $i info: \033[0m" echo -n "IPv4 address: " ifconfig $i 2>/dev/null| egrep -o "inet addr:[^ ]*" | grep -o "[0-9.]*" err echo -n "IPv6 address: " ifconfig $i 2>/dev/null| egrep -o "inet6 addr: [^ ]*" | cut -d " " -f 3| grep -o "[a-z0-9:/]*" err echo -n "MAC address: " ifconfig $i 2>/dev/null| egrep -o "addr .*" | grep -o "[A-Z0-9:]*" err echo -n "subnet Mask: " ifconfig $i 2>/dev/null| egrep -o "Mask:.*" | grep -o "[0-9.]*" err echo -n "Broadcast: " ifconfig $i 2>/dev/null| egrep -o "Bcast:[^ ]*" | grep -o "[0-9.]*" err echo -n "Receive Bytes: " ifconfig $i 2>/dev/null| egrep -o '\([^()]*\)'|head -1 err echo -n "Send Bytes: " ifconfig $i 2>/dev/null| egrep -o '\([^()]*\)'|tail -1 err echo -e "\033[44;37;5m $i Extra information:\033[0m" echo -n "外部IP: " curl ifconfig.me err echo -e done exit
以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。