- IPS=($(ifconfig | grep 'inet addr:' | awk -F'[: ]' '{print $13}' \\
- | egrep -v -e '127\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}' \\
- -e'10\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}' \\
- -e'172\\.(1[6-9]|2[0-9]|31)\\.[0-9]{1,3}\\.[0-9]{1,3}' \\
- -e'192\\.168\\.[0-9]{1,3}\\.[0-9]{1,3}'))
- IPS 为保存有服务器公网IP的数组
- #该片段来自于http://www.codesnippet.cn/detail/060520133147.html
来源: http://www.codesnippet.cn/detail/060520133147.html