xieme-art/content/articles/2024/bash_printf/files/script1_ping.sh

18 lines
340 B
Bash

#!/usr/bin/env bash
PING_ITER=16
# shellcheck disable=2317
command() {
local -r host=${1?"first parameter must be an host"}
local -r iteration=${2?"second parameter must be an iteration number"}
local -r cmd=(ping -c "${iteration}" "${host}")
"${cmd[@]}"
}
main() {
command "aquilenet.fr" "$PING_ITER"
}
main
exit 0