Thursday 1 December 2011

grep has no effect - does not grep anything in this for loop

grep has no effect - does not grep anything in this for loop

#!/bin/bash

for ip in $(seq 200 255); do
nc -vvz 192.168.15.$ip 25 |grep "open" &
done



Thats the code I have, I basically just want to find all the smtp servers in the range, I'm successfully doing it but want to see only the lines that have the word 'open' in it.

When I run the above script, it just shoots out everything as if the grep wasnt there. Not sure what is going on, I'm sure grep probably isn't broken..

No comments:

Post a Comment