nc command in script vs. in shell
I am using the following Linux command and have tried it in a script (tried it in bash and csh) and from the bash shell:
nc -z -w 2 <hostid> 22
where host ID has been validated as a valid domain (tried it on my own domain name).
When I do it at the shell prompt, it works perfectly, but when the script issues the identical command, I get this error:
nc: getaddrinfo: Name or service not known
Can someone give me an idea as to what I am doing wrong?