From e08ff23a8387c95c2f085872beb34f553cc0c686 Mon Sep 17 00:00:00 2001 From: "Nikita S." Date: Fri, 24 Oct 2025 13:56:54 +0300 Subject: [PATCH] refactor(ipregion): use array for ping command with arguments --- ipregion.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipregion.sh b/ipregion.sh index 77285c3..d0613e1 100755 --- a/ipregion.sh +++ b/ipregion.sh @@ -789,9 +789,9 @@ check_ip_connectivity() { log "$LOG_INFO" "Checking IPv${version} connectivity" - ping_cmd=$(get_ping_command "$version") + ping_cmd=($(get_ping_command "$version")) - if [[ -z "$ping_cmd" ]]; then + if [[ ${#ping_cmd[@]} -eq 0 ]]; then log "$LOG_ERROR" "Ping command for IPv${version} is not available" return 1 fi @@ -803,7 +803,7 @@ check_ip_connectivity() { fi for host in "${test_hosts[@]}"; do - if "$ping_cmd" -c "$count" -W "$timeout" "$host" >/dev/null 2>&1; then + if "${ping_cmd[@]}" -c "$count" -W "$timeout" "$host" >/dev/null 2>&1; then log "$LOG_INFO" "IPv${version} connectivity confirmed via $host" return 0 fi