shell脚本 列出所有网卡的ip地址
2016-01-26 16:17
776 查看
#!/bin/bash
for i in `ifconfig | grep -o ^[a-z0-9]*`
do
ifconfig $i|sed -n 2p|awk '{ print $2 }'|tr -d 'addr:'
done
执行结果按行显示所有网卡的ip
ifconfig | grep -o ^[a-z0-9]* 命令列出所有的网卡接口
ifconfig $i|sed -n 2p|awk '{ print $2 }'|tr -d 'addr:' 命令 列出ip
for i in `ifconfig | grep -o ^[a-z0-9]*`
do
ifconfig $i|sed -n 2p|awk '{ print $2 }'|tr -d 'addr:'
done
执行结果按行显示所有网卡的ip
ifconfig | grep -o ^[a-z0-9]* 命令列出所有的网卡接口
ifconfig $i|sed -n 2p|awk '{ print $2 }'|tr -d 'addr:' 命令 列出ip
相关文章推荐
- linux shell 数组建立及使用技巧
- Windows 任务计划程序定时执行 powershell 脚本
- LinuxShell算术运算
- shell 的基础知识
- linux中shell逻辑表达式if else以及大于、小于、等于
- linux shell 简单用法
- 那些提升工作效率的shell命令
- shell 编程
- Cygwin安装curl后 bash: curl: command not found
- Genymotion shell 命令行
- shell之脚本分析
- 监控流量shell脚本
- shell中${}的妙用
- 嵌入式linux:Ubuntu系统下bash和dash的区别(修改默认sh为bash)
- export 原理解析 (Shell Script)
- Windows系统Shell通过Socket转发
- 【shell】删除重复文件
- centos shell编程3【告警系统】 没有服务器端和客户端的概念 main.sh mon.conf load.sh 502.sh mail.php mail.sh disk.sh 第三十七节课
- Hadoop Shell命令
- xshell和xftp