#!/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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-06-18
  • 2021-08-14
  • 2021-10-18
  • 2021-12-31
  • 2022-02-08
猜你喜欢
  • 2021-04-24
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-06-08
  • 2021-12-09
相关资源
相似解决方案