123456789
while read host port; do r=$(bash -c 'exec 3<> /dev/tcp/'$host'/'$port';echo $?' 2>/dev/null) if [ "$r" = "0" ]; then echo "$host $port is open" else echo "$host $port is closed" exit 1 fidone