fix myip command
This commit is contained in:
parent
27e4e89e5d
commit
211b9b6109
@ -1,25 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -m
|
||||||
|
|
||||||
|
|
||||||
TAB="$(printf -- '\t')"
|
|
||||||
readonly TAB
|
|
||||||
|
|
||||||
|
|
||||||
execute_and_format_result() {
|
execute_and_format_result() {
|
||||||
cmd="${@}"
|
cmd="${*}"
|
||||||
|
|
||||||
ip="$(${cmd} 2>/dev/null)"
|
#shellcheck disable=SC2086
|
||||||
|
ip="$(timeout 3 ${cmd} 2>/dev/null)"
|
||||||
|
|
||||||
printf "%s\t%s\n" "${ip}" "${cmd}"
|
printf "%s\t\t\033[0;90m%s\033[0m\n" "${ip}" "${cmd}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${1}" = '--short' ]; then
|
if [ "${1}" = '--short' ]; then
|
||||||
curl ip.thek4n.ru
|
curl -L ip.thek4n.ru
|
||||||
exit "${?}"
|
exit "${?}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
execute_and_format_result curl ipinfo.io/ip &
|
||||||
execute_and_format_result curl ipinfo.io/ip
|
execute_and_format_result curl https://ip.thek4n.ru/ &
|
||||||
execute_and_format_result curl https://ip.thek4n.ru/
|
execute_and_format_result dig +short myip.opendns.com @resolver1.opendns.com &
|
||||||
execute_and_format_result dig +short myip.opendns.com @resolver1.opendns.com
|
|
||||||
} | column -t -s "${TAB}"
|
sleep 0.7
|
||||||
|
exit 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user