#!/bin/bash ip=$l tcpscan() { ip=$i for port in $(seq 1 65535); do timeout 1 bash -c " /dev/null" 2>/dev/null || echo Connection timeout > /dev/null done } tcpscan $ip