# 1myip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')echo $myip# 2myip=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')echo $myip
1200字范文,内容丰富有趣,写作的好帮手!
时间:2022-03-18 05:16:26
# 1myip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')echo $myip# 2myip=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p')echo $myip
Shell脚本中获取本机ip地址 Linux获取本地ip地址
2022-03-11
centos7 shell 获取ip_Linux Shell脚本中获取本机ip地址方法
2022-02-06