#!/bin/bash host="$1" port="$2" [[ ${port} =~ ^[0-9][0-9]*$ ]] || { echo "The given port $port (2. argument) is not valid." >&2 && exit 1 ; } shift 2 IFS="," for f in $@ do { echo "${f}" && cat "${f}" ; } | ncat -i1 $host $port done