Could anybody please tell me how in a script I could implemnet the following:

I want to open a remote port on a remote host retrieving the banner if there is one - for this I'm using netcat as follows nc -v $host+':':$port within some nested loops.

The problem is that the script needs to break out of the connection after a couple of seconds with or without a banner otherwise it gets stuck with something like : BlahFTP server (Enter USER:
and stays like that. I just need it to cancel and continue looping through the script.

Any ideas?

Thanks