IP=`/sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;#该片段来自于http://www.codesnippet.cn/detail/0810201410522.html
来源: http://www.codesnippet.cn/detail/0810201410522.html