Pass this script an IP address or domain name followed by a port number and we will print the contents of that connection to the screen.

#!/bin/bash

if [ -z "$1" ] || [ -z "$2" ]; then
    echo -en "\n\nUsage: bash check_port.bash [IP]127.0.0.1 [PORT]22\n\n"
else
    cat < /dev/tcp/$1/$2
fi