需要安装jq
ubuntu@gooderver:~$ ip -j -4 addr show | jq '.[]|.addr_info|.[]|.local'
"127.0.0.1"
"172.24.64.162"
ubuntu@gooderver:~$ ip -j -6 addr show | jq '.[]|.addr_info|.[]|.local'
"::1"
"2403:ac00:xxxx"
"fe80::e654:e8ff:fea3:6a01"
ubuntu@gooderver:~$ ip -j -6 addr show | jq -r '.[]|.addr_info|.[]|.local'
::1
2403:ac00:xxxx
fe80::e654:e8ff:fea3:6a01
标签:shell,gooderver,addr,show,ip,jq,地址,ipv4,local
From: https://www.cnblogs.com/wangbingbing/p/17185709.html