$ nmap -Pn -p993 imap.gmail.com |& grep -q 'Host is up' && { ... }

And of course someday the printed text will change and I'll have to edit
my scripts again!  Oh well.  :-/


Host is up wouldn't be right - you need to parse to see if the port is listed as open or closed... 

Something like:

nmap  -Pn -p993  imap.gmail.com | awk '$1 ~ /993/ {print $2}'  | grep open