nc missing option -z
Suvayu Ali
fatkasuvayu+linux at gmail.com
Wed Feb 13 10:02:23 UTC 2013
Hi Ed and James,
On Wed, Feb 13, 2013 at 09:45:05AM +0000, James Hogarth wrote:
> > $ 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
I read the man page, but wasn't thinking when I wrote the grep line :-p.
You are right, looking for the port/service is the correct way.
I think the older package was nc, but I'm not very much in for of
checking versions. That would unnecessarily complicate my simple
scripts. I cannot use tcping as Ed suggested because it is not
installed in these other systems, hence parsing nmap output seems my
only viable option.
Thanks a lot for all the help.
Cheers,
--
Suvayu
Open source is the future. It sets us free.
More information about the users
mailing list