Telnet IP and Port Script

Hi,

I would like to create a simple script that will telnet a number of IP and Ports one after the other to confirm connectivity to those addresses.

I don't need to log on, just output to a file what the response is, i.e Escape Character, connectivity refused etc.

Complete newbie to shell scripting so ideally something that isn't to complex.

Any ideas on where to start?

I have looked through the search results and have the following based on an existing script.

 
#!/bin/sh
set -vx
read line < portTest
OIFS=$IFS
IFS=#;
for i in $line;
do
# check for open ports #
connTest=`echo " " |telnet "$i"`
if [ "`echo $connTest | awk '{ print $3 }` " = "Connected" ]
then
echo "$connTest port is up"
else
echo "$connTest port is down"
fi
done

This refers to a file "portTest" which looks like this:
139.xxx.xxx.xxx 7001#139.xxx.xxx.xxx 7011#139.xxx.xxx.xxx 2001#

If I echo the variable $i earlier in the script than the telnet command it prints the whole value up to #, but when it sends the telnet request the port is not included.

Any ideas why?

look man:nc

Is this refering to Netcat?

I get nothing when entering that. I don't believe it is installed on my server.

Yes it's refering to netcat....it's damage, it's a good tool.
What's your system ???

I am running this on a Solaris 5.10 host which I have limited rights to.

I know this is not pretty / the right way of doing it. But my scripting knowledge (as you can see) is very limited and I just want something quick and dirty.