netstat grep regex suspend script help

view full story

http://www.unix.com – Hi I am trying to create a suspend script which will suspend the system only if it cant find port 9982 four or more times OR 192.168.0.:microsoft-ds ESTABLISHED in the output of netstat -t. I am struggling with the 9982 bit, googling etc I came up with Code: if netstat -t|grep -P "(9982){4,}" but this does not return anything when there is four or more instances of 9982. Also is this script okay? Code: #!/bin/bash if netstat -t|grep -P "(9982){4,}" ; then         exit         elif         netstat -t| (HowTos)