21 lines
329 B
Bash
Executable File
21 lines
329 B
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
TAB="$(printf -- '\t')"
|
|
readonly TAB
|
|
|
|
|
|
execute_and_format_result() {
|
|
cmd="${@}"
|
|
|
|
ip="$(${cmd} 2>/dev/null)"
|
|
|
|
printf "%s\t%s\n" "${ip}" "${cmd}"
|
|
}
|
|
|
|
|
|
{
|
|
execute_and_format_result curl ipinfo.io/ip
|
|
execute_and_format_result dig +short myip.opendns.com @resolver1.opendns.com
|
|
} | column -t -s "${TAB}"
|