From dfe371d8e4454187ef30770826650a08944f966b Mon Sep 17 00:00:00 2001 From: thek4n Date: Thu, 2 Jul 2026 00:49:30 +0300 Subject: [PATCH] fix myip command --- home/user/.local/bin/myip | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/home/user/.local/bin/myip b/home/user/.local/bin/myip index e828eb1..37d0e2a 100755 --- a/home/user/.local/bin/myip +++ b/home/user/.local/bin/myip @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -m TAB="$(printf -- '\t')" @@ -6,20 +6,21 @@ readonly TAB execute_and_format_result() { - cmd="${@}" + cmd="${*}" - ip="$(${cmd} 2>/dev/null)" + #shellcheck disable=SC2086 + ip="$(timeout 2 ${cmd} 2>/dev/null)" printf "%s\t%s\n" "${ip}" "${cmd}" } if [ "${1}" = '--short' ]; then - curl ip.thek4n.ru + curl -L ip.thek4n.ru exit "${?}" fi { - execute_and_format_result curl ipinfo.io/ip - 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 curl ipinfo.io/ip & + execute_and_format_result curl https://ip.thek4n.ru/ & + execute_and_format_result dig +short myip.opendns.com @resolver1.opendns.com & } | column -t -s "${TAB}"