[Trilug-ontopic] yet another perl/expect question, round 2
Trevor Little
trevormg19 at gmail.com
Thu Jan 21 12:20:07 EST 2010
Remember that parens and question marks are special in regular
expressions, so you probably need something like this:
'Do.*\(Y/N\)\?'
Trevor
On Thu, Jan 21, 2010 at 12:14 PM, Greg Brown <gwbrown1 at gmail.com> wrote:
> Ok, this is annoying.. my script works perfectly until the last line.. here
> are the last couple of lines:
>
> Primary DNS Server: 192.168.124.221
> Optional DNS Server: 192.168.134.29
> Is the above information correct (Y/N)?Y
> You must reboot the sensor to take the setting effects
> Do you want to reboot now(Y/N)?
>
> An oc -d of the last three lines looks like this:
>
> 0000000 I s t h e a b o v e i n f
> 0000020 o r m a t i o n c o r r e c t
> 0000040 ( Y / N ) ? Y \n Y o u m u s
> 0000060 t r e b o o t t h e s e n
> 0000100 s o r t o t a k e t h e
> 0000120 s e t t i n g e f f e c t s \n
> 0000140 D o y o u w a n t t o r
> 0000160 e b o o t n o w ( Y / N ) ? \n
> 0000200 \n
> 0000201
>
>
> I have tried *EVERYTHING* to match that last line including:
>
> # now it tells us we must reboot (which we just told it we wanted to
> do).. so send another Y
> my($which, $why, $match, $before, $after) =
> $ssh->expect(30,'-re','You.*');
>
> # now it tells us we must reboot (which we just told it we wanted to
> do).. so send another Y
> my($which, $why, $match, $before, $after) = $ssh->expect(30,'*');
>
> # now it tells us we must reboot (which we just told it we wanted to
> do).. so send another Y
> my($which, $why, $match, $before, $after) =
> $ssh->expect(30,'-re','You.*(Y/N)?');
>
> I've even tossed out the "You" and started with "Do"... and I've tried to
> take the "magic match any darn thing" too.
>
> And a thousand other combinations and nothing works. Does anyone have any
> ideas? this is really giving me a headache.. The line above ends much the
> same, but not exactly, but I've matched that and using the line below and it
> works fine... ugh. Any ideas would be very welcomed at this point...
>
> # now it wants to know if you want to reboot (and we do)
> my($which, $why, $match, $before, $after) =
> $ssh->expect(30,'-re','The.*(Y/N)?');
>
> Greg
>
>
>
>
>
> _______________________________________________
> Trilug-ontopic mailing list
> Trilug-ontopic at trilug.org
> http://www.trilug.org/mailman/listinfo/trilug-ontopic
>
>
More information about the Trilug-ontopic
mailing list