shell获取本地ip Breeze不栗子 2023-02-16 81 阅读1分钟 #!/bin/bash # ifconfig 过滤得到所有ip,head -1取第一个ip ip=`ifconfig -a | grep inet | grep -v inet6 | grep -v 127.0.0.1 | awk '{print $2}' | head -1` echo $ip