From: Bradford R. <bt...@po...> - 2007-03-15 18:05:08
|
I would use a hex editor to view the log file so that you can see all characters literally. Use "man ascii" to figure out what each one means. Sometimes it's a CR or LF character that you're not catching. vim can do hex editing. Start vim, then type :help hex and it will explain how to do it. There are other hex editors out there if you don't want to use vim. It's strange that the third prompt isn't matching since that's the simplest one out of the three. The expect command you show below has "fancy" double-quotes around login: How did this happen since I would expect you to cut/paste the command all at once. The only suggestions I have is to try to do a single expect command for just the third prompt to make sure you can match it. Then add the other two. Also try taking out the space following the colon. It probably won't help, but try anyway. :) -- Brad On 3/15/07, al....@ac... <al....@ac...> wrote: > > Hello everyone, > > > > I need a bit of help with figuring out a problem with my Expect Perl > script and was hoping someone on the list might be able to point me in right > direction. I use Expect Perl module in my script for executing commands > remotely on some of my servers. The script uses Open SSH (4.2p1) on > Solaris 2.8 for logging into each remote server. The remote servers run on > a proprietary UNIX OS which can send back any of the following single or > multi line prompts during the SSH attempt: > > * * > > *The authenticity of host 'testserver (10.10.11.12)' can't be established. > * > > *RSA key fingerprint is 8e:be:a4:4c:55:09:e8:72:f8:2b:e9:60:0c:84:f6:39.* > > *Are you sure you want to continue connecting (yes/no)?* > > > > or > > > > *User1@testserver's password: * > > > > or > > > > *Blank line* > > *Blank line* > > *Data ONTAP (testserver.domainname.com)* > > *login:* > > > > For checking the prompts I am trying something similar to the following: > > > > *$Prompt = 'Are you sure you want to continue connecting (yes/no)? '; *- > This is the last line from the first prompt above.** > > * * > > *$which = $exp->expect ( 20, "$user_id\@$host_ip\'s password: ",$Prompt, > "login: ","[local_host_name%#]" )*; > > > > I am using $which variable to find out which prompt is matched. This > appears to be working for the first two prompts but not for the third one. > I enabled logging to a file and noticed the following when opened the log > file via *vi*: > > > > *^M* > > *^M* > > *Data OnTap (testserver.domainname.com)^M* > > *login:* > > > > I can't tell if there is any other hidden character in the above prompt. I > don't know what regular expression to use to match for the above multi line > prompt and am not sure why the $Prompt work for the first multi line > prompt. Currently the following packages are installed on my Sun box: > > > > expect-5.43.0-sol8-sparc-local > > Expect-1.20 > > IO-Tty-1.07 > > perl-5.8.7-sol8-sparc-local > > > > Any help is appreciated. > > > > > > > > > > This message is for the designated recipient only and may contain > privileged, proprietary, or otherwise private information. If you have > received it in error, please notify the sender immediately and delete the > original. Any other use of the email by you is prohibited. > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > |