From: Austin S. <te...@of...> - 2008-06-10 18:34:12
|
On Tue, Jun 10, 2008 at 11:25:19AM -0700, Noah wrote: > Hi, > > sometimes the RSA fingerprint is not in ~/.ssh/known_hosts so the prompt > could be different. > > what would be the best way to handle the differences. there is one more > prompt to handle, defined as $prompt2, when the IP or hostname does not > appear in ~/.ssh/known_hosts. How would you handle the condition and > then move back to accepting $prompt1? > > > > $prompt1 = ".*password:"; > $prompt2 = "^[^?]+?\s"; > my $patidx = $exp->expect($timeout, [$prompt]); > Expect both prompts at once. Run until $prompt1 is matched. You can do this one of two ways: use the simple interface and wrap it in a while loop, or you can use the "Tcl like" interface and use exp_continue. See the expect example in the synopsis section of the docs. Austin |