欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

自己亲自做的 查看我的 ip 地址和 mac 地址 view_my_ip_mac 有大用 有大大用

#!/bin/bash
#
ifconfig en0 | grep "10\.\|192\." | grep -F ".255"
if [ $? = 0 ]; then
    status=0
    mac=$(ifconfig en0 | grep ether | grep ..:..:..:..:..:.. | awk '{print $NF}')
    ip=$(ifconfig en0 | grep -i -F "inet" | grep -F ".255" | awk '{print $2}')
else
    mac="                    "
    ip="                    "
fi
ifconfig en1 | grep "10\.\|192\." | grep -F ".255"
if [ $? = 0 ]; then
    status=0
    mac1=$(ifconfig en1 | grep ether | grep ..:..:..:..:..:.. | awk '{print $NF}')
    ip1=$(ifconfig en1 | grep -i -F "inet" | grep -F ".255" | awk '{print $2}')
else
    mac1="                    "
    ip1="                    "
fi
str="mac: ${mac},ip:${ip}"
str1="mac1: ${mac1},ip1:${ip1}"
(/usr/bin/osascript -e "display dialog \"$str \\n$str1\" buttons {\"OK\"}   default button \"OK\" "   )


普通分类: