ipaddr='172.0.0.1'ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')echo $ipaddr
本文共 184 字,大约阅读时间需要 1 分钟。
ipaddr='172.0.0.1'ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}')echo $ipaddr
转载于:https://www.cnblogs.com/lixiaolun/p/5733452.html