linux下获取ip

ip=$(ifconfig |grep broadcast|awk 'NR<2 {print $2}')
echo $ip
ifconfig

原文地址:https://www.cnblogs.com/boye169/p/14433194.html