I want to make a script which will check if a port is open on a server. If not open stay in a while. If open continue. The break conditions is use are if "host is up" is present and not "closed". I assume conenction is ok. The problem is that the grep is not working as expected.
I have tried with following:
while true; do NMAP=$(nmap -p 1700 router.eu.thethings.network) if [[$NMAP | grep "Host is up" -ne ""]] && [[$NMAP | grep "closed" -eq ""]]; then echo "connection!!!" break fi echo "waiting for connectiong" done
I run it on a raspberry pi jessie system.