脚本获取本机IP

思路:拿到网关地址段的网卡后,找对应网卡出口的IP.

route -n | grep UG |awk '{print $NF}' | xargs ifconfig | grep 'inet ' | awk '{print $2}'

猜你喜欢

转载自blog.csdn.net/qq_38900565/article/details/106946258