Sheldon Xu

2012年5月14日

Shell script: 获取适配器/IP/子网掩码/网关地址的脚本

摘要: #/bin/bashadapter=$(ifconfig | grep -m1 'encap:Ethernet' | cut -d' ' -f1)echo "Adapter: $adapter"ip=$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')echo "IP: $ip"mask=$(ifconfig | grep 'Mask:'| 阅读全文

posted @ 2012-05-14 15:55 Sheldon Xu 阅读(2091) 评论(0) 推荐(0) 编辑

导航