Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell script for telnet

Status
Not open for further replies.

Yiyi

Programmer
May 31, 2001
13
CA
I used following script:

telnet <IPAddress> <<!
<username>
<password>
!

And I got &quot;Connection closed by foreign host.&quot;

Can anyone explain me why?

Appreciate for your help
 
You can't use telnet that way. Why do you need to do this? Do you need to run a command on the remote machine? If so, have a look at the rsh threads in the General Unix Discussion/Solaris forums.

Greg.
 
check out the perl telnet module, otherwise you could use expect to automate the telnet session. But perl is the way to go
 
Because the remote host might not trusted host, even running on different OS, so I have to use telnet. And I have done that with expect.


Thanks for your valuable advice!
 
There's another way to communicate between the server and the client.
You can use socket communication with perl, and if you want to execute something, you can combine it with Shell script.
But I still have a problem with executing from shell script. Somehow it keeps gave me memory fault (core dump) when I tried to call C program from shell script.
Could anyone tell me how to run C program including pass the variables from Perl?
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top