Bash : Script Ping

De www.yakakliker.org
Révision datée du 30 avril 2024 à 08:51 par Administrateur (discussion | contributions) (Page créée avec « <syntaxhighlight lang="bash"> #!/bin/bash IP="8.8.8.8" # Replace with the IP address you want to ping COUNT=1 # Number of ping attempts if ping -c $COUNT $IP > /dev/null 2>&1; then echo "Ping to $IP was successful." else echo "Ping to $IP failed." fi </syntaxhighlight> === Liens === https://tecadmin.net/check-network-connectivity-using-ping-in-shell-scripts/ Catégorie:Scripts Catégorie:Bash Catégorie:Linux »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
#!/bin/bash
 
IP="8.8.8.8" # Replace with the IP address you want to ping
COUNT=1 # Number of ping attempts
 
if ping -c $COUNT $IP > /dev/null 2>&1; then
  echo "Ping to $IP was successful."
else
  echo "Ping to $IP failed."
fi

Liens

https://tecadmin.net/check-network-connectivity-using-ping-in-shell-scripts/