From: Ian M. <iw...@do...> - 2007-11-06 10:20:05
|
> > >Hi guys, > >I am new to perl and expect. I started putting a script together that >telnets into desired devices one at a time and runs specified commands. >Problem I have is, that the prompt on this hosts does not follow a certain >norm. Some prompts are in caps, some are in lower caps. Normally, prompts >are device names, but in some case our device names exceeds the number of >characters allowed in the hostname, so it cuts of the exceeded letters. So >having the following doesn't really work at times: > >$telnet->expect($timeout, "$HostName"); > >Is there anyway, I can do this. That once I spawn the telnet session and >log in. The prompt that it gets, it stores it into a variable and than I >can leverage that variable throughout my script wherever it expects a >prompt. > >Also, these devices are all cisco devices. Is there a recommended timeout >values? I have $telnet->exp_internal(1) in my script. So In middle of the >output after a command is run, I see several /r's. Thanks in advance for >your help. > >Amit. >-- >View this message in context: http://www.nabble.com/Having-problems-with-prompt-tf4737304.html#a13547267 >Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com. > > >------------------------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. >Still grepping through log files to find problems? Stop. >Now Search log events and configuration files using AJAX and a browser. >Download your FREE copy of Splunk now >> http://get.splunk.com/ >_______________________________________________ >Expectperl-discuss mailing list >Exp...@li... >https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > I have found when using expect with a linux shell that various characters but mostly carriage return are inserted in output lines. I realised that the shell was wrapping long lines and was in edit mode, where some input characters cause extra output as part of the line editing. Perhaps if you could tell your telnet and cisco shell to use as long a line as possible and use what my telnet manual calls old telnet line by line, where only complete lines are to the the remote host then no extra characters are returned. Ian W Moor Department of Computing, iw...@do... Imperial College. 180 Queensgate London SW7 2AZ UK. |