shell脚本如何获取本地ip

2024-10-14 19:19:24

1、打开终端,使用“vi”指令创建一个shell文件

shell脚本如何获取本地ip

3、然后我们在该文件中输入下列指令:/sbin/ifconfig -a|grep 坡纠课柩inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"

shell脚本如何获取本地ip

5、此时已经生成了此Shell文件,再在终端中敲入“chmod”指令来提升该Shell文件的权限

shell脚本如何获取本地ip
猜你喜欢