Skip to content

Instantly share code, notes, and snippets.

@zfogg
Created October 16, 2020 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zfogg/f7fae4492cf7d6c2bcf68ee25ccbd28e to your computer and use it in GitHub Desktop.
Save zfogg/f7fae4492cf7d6c2bcf68ee25ccbd28e to your computer and use it in GitHub Desktop.
network testing on any UNIX system without calling any binaries
#!/usr/bin/env sh
address=${1:-localhost}
port=${2:-53}
proto=${3:-tcp}
(echo > "/dev/$proto/$address/$port") >/dev/null 2>&1 \
&& echo "✅ $address:$port is ONline ✅" \
|| echo "⛔ $address:$port is OFFline ⛔"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment