gpt4 book ai didi

linux - 如何削减 ifconfig 以单独获取 eth* 详细信息?

转载 作者:太空宇宙 更新时间:2023-11-04 11:28:42 25 4
gpt4 key购买 nike

我正在编写一个脚本来打印 ifconfig 的 ethtool 详细信息。

示例输出应该来自 ifconfig 之类的,

eth0
eth1
eth2

我试过使用下面的命令,

root@bt# ifconfig | cut -d ":" -f 1 

但无法达到同样的效果。

实际上,我需要获取这些eth*并传入

root@bt# ethtool <arg1> where arg1=eth*

为了获得结果 :-) 你能帮我从 ifconfig 中获取裁剪吗? ?

最佳答案

没有。

$ awk -F: '$1 ~ "eth" { print $1 }' /proc/net/dev
eth0

关于linux - 如何削减 ifconfig 以单独获取 eth* 详细信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12664473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com