Skip to content

Instantly share code, notes, and snippets.

@Memphizzz
Created February 21, 2019 17:57
Show Gist options
  • Save Memphizzz/df5762499a3ae713976ec7e1ec25265c to your computer and use it in GitHub Desktop.
Save Memphizzz/df5762499a3ae713976ec7e1ec25265c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
ping_cancelled=false
until ping -c1 "$1" &>/dev/null; do :; done &
trap "kill $!; ping_cancelled=true" SIGINT
wait $!
trap - SIGINT
echo "Done pinging, cancelled=$ping_cancelled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment