$ cat ifconfig.sh
#!/bin/bash
ip_addr='ifconfig -a |grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"'
for i in $ip_addr
do
echo "$i"
done
#!/bin/bash
ip_addr='ifconfig -a |grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"'
for i in $ip_addr
do
echo "$i"
done
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/15498/viewspace-1969146/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/15498/viewspace-1969146/
本文介绍了一个使用bash脚本自动获取网络接口地址的方法,通过执行一系列shell命令,可以方便地收集并显示所有可用网络接口的详细信息。
1179

被折叠的 条评论
为什么被折叠?



