好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

shell脚本获取当前ip地址 - Linux操作系统:Ubuntu_


需求

shell脚本里我需要根据不同的ip地址做出不同的操作,因此我需要在shell脚本里获取当前主机的ip地址

  www.2cto.com  

 

我需要获取到192.168.1.111这个ip地址

  www.2cto.com  

[ html ] 

 

ifconfig |grep 'inet 地址'|grep '192.168.1' | grep -v 'grep' | awk '{print $2}'| tr -d "地址:"  

效果

查看更多关于shell脚本获取当前ip地址 - Linux操作系统:Ubuntu_的详细内容...

  阅读:50次