Created
June 14, 2021 05:47
-
-
Save iflamed/d3037937045cbac878e55e2ae658aaa7 to your computer and use it in GitHub Desktop.
获取linux/mac 主机IP地址
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v 169.254|grep -v 0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" | head -n 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
export HOST_IP=
ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v 169.254|grep -v 0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:" | head -n 1