shell_tools/pip
2024-01-08 08:48:13 +08:00

56 lines
1.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 获取公网IP
# 相关参数
## 版本号
VERSION=0.1.0
# 相关方法
## 帮助
help () {
echo 'Usage: pip 参数'
echo '示例:'
echo ' 仅获取IP pip'
echo ' 以JSON格式返回 pip json'
echo ' 获取详细信息(含物理地址、运营商): pip all'
}
## 版本号
version () {
echo 'pip '$VERSION
}
## 仅获IP
pip () {
echo '------------------------------ 正在获取公网IP请稍后... ------------------------------'
curl icanhazip.com
}
## JSON格式返回
json () {
echo '------------------------------ 正在获取公网IP请稍后... ------------------------------'
curl https://openapi.lddgo.net/base/gtool/api/v1/GetIp
}
## 详细信息(含物理地址、运营商)
all () {
echo '------------------------------ 正在获取公网IP请稍后... ------------------------------'
curl cip.cc
}
# 执行方法
case $1 in
help)
help
;;
version)
version
;;
all)
all
;;
json)
json
;;
*)
pip
;;
esac