rlogin and telnet

I want to make a script which will execute a command from a remote server like below

rlogin server1
then
telnet server2
(username, password will be given)

now execute command (it may "ls -l *.txt") and give the output

I've to do this manually but want to make it automatic
Script may be bash or perl

Please help me. I searched the forum but not get the solution.

Use rsh. It can directly execute the command for you. Please search this forum for rsh.

-Devaraj Takhellambam

Thanks a lot Devaraj!

If u give such link which meets my requirements it will be vary helpful for me. As I'm a beginner.

-----Post Update-----

Is there anyone to help me more?

-----Post Update-----

Is there anyone to help me more?

I did it with expect script. But it shows the login prompt in the terminal. I need only the command output in the terminal nothing else Please help me.

Mr. Devaraj! I searched a lot about rsh but did not find any helpful information. Please provede me the link or give the syntax with an example

-----Post Update-----

I did it with expect script. But it shows the login prompt in the terminal. I need only the command output in the terminal nothing else Please help me.

Mr. Devaraj! I searched a lot about rsh but did not find any helpful information. Please provede me the link or give the syntax with an example

I did it with expect script. thanks all