in reply to Re^3: ssh using expect
in thread ssh using expect

Hi, I need help with the following issue where in interactive menu selection works fine manually but fails with perl ssh expect. When executing manually i get the following:
Please enter the operation serial number. >1 NO. NE name + NE type name + 1 TB2SEE + HW_SEE + 2 UKTB2SEE + HW_SEE + 3 TB2SLEE + HW_SLEE + 4 UKTB2SLEE + HW_SLEE + ***************Input Tips************* a: To create a tracing task for an NE, enter the NE number. b: To create a tracing task for multiple NEs, enter the NE numbers and + separate every two of them with a plus sign (+). Example: 1+2. c: To create a tracing task for all NEs, enter 0. ************************************** Please enter the NE serial number. >
but when i run it from perl i get the following:
main::(iTrace_start_stop.pl:48): $ssh->waitfor('Please\senter\s +the\soperation\sserial\snumber.\s*', 2) or die "prompt 'operation ser +ial number' not found after 2 second"; DB<1> main::(iTrace_start_stop.pl:49): $ssh->send("1"); DB<1> main::(iTrace_start_stop.pl:50): print $ssh->peek(1); DB<1> >1 NO.NE nameNE type name ---- More (Enter to show More) ----
My code is as follows:
$ssh->waitfor('Please\senter\sthe\soperation\sserial\snumber.\s*', 2) + or die "prompt 'operation serial number' not found after 2 second"; $ssh->send("1"); print $ssh->peek(1); $ssh->send("2");