Store Host lookup in variable ("on the fly")

Hi,

I'm new here. I was wondering why I can't store a host lookup in a variable.

for line in $(< blacklist)
do
STOREIP=host $line;
if [[ $storeip != *bot* ]]; then
$line >> blacklist2;
else
$line >> blacklist3;
fi
done

Result: "ip" command not found .. so how would I store the host lookup in the variable?

Basically I have IP's stored in a file and want to check them via rdns if they include the string "bot". If they dont I want to save them in blacklist2, if they do in blacklist3.

If anyone could help me out with this I'd be grateful... I'm pretty new to this and so far I really like how easy it is to write some useful scripts, but this is a bit too difficult for me.

Thanks a lot!
Oliver

STOREIP=`host $line`

Do not forget that the variables are case sensitive.

Following are recommended changes to your script:

STOREIP=$(host $line)
if [[ $STOREIP != *bot* ]