bhushanQA has asked for the wisdom of the Perl Monks concerning the following question:
output of this is:use Expect; use IO::Stty; my $sg_viewer = Expect->spawn("ssh -l user <IP address>"); #$sg_viewer -> log_stdout(0); $sg_viewer->expect( 5, '-re', "Password:" ); sleep 1; $sg_viewer->send("user\n"); $sg_viewer->expect( 5, '-re', "passwd@123" ); sleep 1; $sg_viewer->send("su - root\n"); $sg_viewer->expect( 5, '-re', "Password:" ); sleep 1; $sg_viewer->send("user\n"); $sg_viewer->expect( 5, '-re', "newroot" ); sleep 1; $sg_viewer->send("su - mmadmim\n"); $sg_viewer->expect( 5, '-re', "Password:" ); sleep 1; $sg_viewer->send("attachtoprocess\n"); # this is the internal p +rocess which I am accessing... $sg_viewer->interact(); # used interact module here to interact + with process sleep 1; $sg_viewer->send("4"); # sending 4 as process have so many opti +ons to access the internal things.. but code is not going inside. $sg_viewer->send("exit\n");
I am sending 4 to access the BM4 ( process of process) but not happening.. any help??[mmadmim@SG ~]$ attachtoprocess -------------------------------------------------- The process list: >1. BM 00 2. BM1 00 3. BM2 00 4. BM3 01 5. BM4 01 -------------------------------------------------- Press ESC to quit.
|
|---|