取出本机IP地址:
ifconfig|grep Bcast|awk -F: '{print $2}'|awk -F " " '{print $1}'
ifconfig eth0|grep Bcast|awk -F: '{print $2}'|awk -F " " '{print $1}'
取出本机IP地址个数:
ifconfig|grep Bcast|awk -F: '{print $2}'|awk -F " " '{print $1}'|wc -l
本文转自leonardos51CTO博客,原文链接:http://blog.51cto.com/leomars/487864,如需转载请自行联系原作者