Operating System - HP-UX
1825987 Members
3460 Online
109690 Solutions
New Discussion

Re: telnet session script

 
girish_n
New Member

telnet session script

The below code when called within a script works on Sun but the same does not work in HP UX. Is there anything to be added or removed from the code ....
The code shown below telnets to the port 10054 on IP 10.11.12.13 and shows the local file file.txt and then close the telnet session that was opened.

send_alarm() {
telnet 10.11.12.13 10054 <<-EOF
echo `cat /home/abc/file.txt`
quit
EOF
}
1 REPLY 1
David de Beer
Valued Contributor

Re: telnet session script


Hi, can you give us a -x (debug) on the script? i.e. #!/bin/ksh -x instead of #!/bin/ksh

I tried the following and it worked fine:

/tmp/david/t.sh:
send_alarm() {
telnet localhost 25 <<-EOF
`cat /tmp/david/telnet.text`
quit
EOF
}

send_alarm

/tmp/david/telnet.text:
HELP


If you want the commands executed, I suggest to take the 'echo' away..

Kind regards,
David de Beer.