diff --git a/lookup.sh b/lookup.sh new file mode 100644 index 0000000..578c3e7 --- /dev/null +++ b/lookup.sh @@ -0,0 +1,20 @@ +#!/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 +while read ip n +do + if [ -z "$2" ] + then + echo $(host "$ip") + else + echo $(host "$ip" "$2") + fi +done < $1 \ No newline at end of file