Test if port 22 is open
port=22
timeout=5
if (( "$#" != 1 )); then
echo "usage: $(basename $0) HOST"
fi
host=$1
if nc -w $timeout -z $host $port; then
echo "Yes"
else
echo "No"
fi
port=22
timeout=5
if (( "$#" != 1 )); then
echo "usage: $(basename $0) HOST"
fi
host=$1
if nc -w $timeout -z $host $port; then
echo "Yes"
else
echo "No"
fi