#!/bin/bash if [ -z "$1" ] then echo "You must specify a filename to read from" exit 1 fi if [ ! -f "$1" ] then echo "File $1 does not exist or is not a file" exit 1 fi if [ -z "$2" ] then echo "Please, specify a port" exit 1 fi while read ip n do nc -z -v -w1 "$ip" "$2" # [[ -z "$resolvedIP" ]] && echo "$ip" lookup failure || echo "$ip" resolved to "$resolvedIP" done < $1