Wind__Fantasy

导航

mac osx 获取内网ip的方法

(1) ping -c 1 $(hostname) | grep -m 1 -oP '(\d+\.)+\d+' # ping selfhost and catch the first matched ip

 

(2) host $(hostname) | grep -oP '(\d+\.)+\d+' # catch matched ip from selfhost's hostname and ip

posted on 2011-12-08 10:07  Wind__Fantasy  阅读(548)  评论(0编辑  收藏  举报