Last Updated: February 25, 2016
·
160
· ruurd

check status of port

OK. At least partially stolen from commandlinefu. Added some polish to it.

#!/bin/sh
printf "Port ${1:-80} on ${2:-127.0.0.1} is "
(: </dev/tcp/${2:-127.0.0.1}/${1:-80}) &>/dev/null \
&& echo"OPEN" || echo "CLOSED"

Watch the wrap.