#!/bin/bash # $1 filename with names of subdoman # $2 main domain for name in $(cat $1); do host $name.$2 | grep "address" done