Unexepcted behavior from read and cat

Erik Osterholm freebsd-lists-erik at erikosterholm.org
Tue May 13 15:05:16 UTC 2008


On Mon, May 12, 2008 at 12:22:48PM -0700, Johan Dowdy wrote:
> For loops are your friend.
>
> I'd do something like:
>
> for i in `cat iplist`
>  do dig +short -x $I
> done

Even better:
while read i
  do dig +short -x $i
done < iplist

See the Useless Use of Cat Award for more details.

Erik


More information about the freebsd-questions mailing list