#!/bin/bash # check state for specific ports on target for i in 80 443; do echo -e '\x1dclose\x0d' | telnet google.com $i >/dev/null; echo "$i : $?"; done