1、ip文件
#!/bin/sh
local_ip=$(ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d "addr:")
echo "${local_ip}" | pbcopy
echo "${local_ip}"
2、把ip文件拷贝到/usr/local/bin目录中即可
1、ip文件
#!/bin/sh
local_ip=$(ifconfig -a | grep inet | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | tr -d "addr:")
echo "${local_ip}" | pbcopy
echo "${local_ip}"
2、把ip文件拷贝到/usr/local/bin目录中即可
本文标题:mac 自制一个获取IP的shell命令
本文链接:https://www.haomeiwen.com/subject/mbfpfrtx.html
网友评论