...run a few commands at the command line (change shell, setenv etc)and then continue working on the unix box. How do I break out of the script on the remote machine?
Your Net::Telnet script is seen by your host as a single telnet access to it. When the script ends, the network connection is close and the host session is lost (login shell terminated).
- The first solution I see is to drive a real telnet client, feeding it with your commands from a script.
- Depending on the Perl distrib you have, you may also use Expect.
- You may even write your own terminal emulator, replacing the sleep 2; pause with a (quasi-)infinite loop waiting for an input, sending it and displaying the output back to you.
You might also have other solutions involving a specific configuration of the pseudo-terminals of your destination host, but they are beyond my knowledge of the Unix system.
____
HTH, Dominique
My two favorites:
If the only tool you have is a hammer, you will see every problem as a nail. --Abraham Maslow
Bien faire, et le faire savoir...