in reply to Remote server file access issue
#!/usr/bin/perl $| = 1; # make output unbuffered prompt(); while(<STDIN>) { # read 1 line... eval $_; # ...doit... warn $@ if $@; # ...complain if error prompt(); # ...and print prompt; } sub prompt { print "\n;# perl > " } __END__
Place that script in your home directory on the remote server, and call perl to execute it:
Now you can talk to perl.$telnet->cmd('perl perlshell.pl');
Note that to logout you have to $telnet->cmd('exit') twice, one time to terminate perl, the next to terminate your login shell.print $telnet->cmd('print scalar localtime(time)'); Thu Jun 29 15:58:52 2006 print $telnet->cmd('print $^X'); /usr/bin/perl
update: One exit alone leaves you again at the ksh prompt. Note also that you cannot issue multiline statements, as the remote perl interpreter reads one line at a time.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|