Operating System - Linux
1753867 Members
7468 Online
108809 Solutions
New Discussion

How to intercept a "[" in an expect script ?

 
Michele (Mike) Alberton
Regular Advisor

How to intercept a "[" in an expect script ?

Hi,

I'm not too much familiar with expect scripts but I was trying to automate access to a character interface used by our application.

Unfortunately one of the outputs I'm trying to identify reads like this:

"Current Mate High Availability State is [ACTIVE]"

and it seeems the "[" and "]" are not properly matched since they're interpreted as delimiting a command.

I tried to mask them using shell like "\", or doubling the characters but my expect keeps exiting with:

invalid command name "ACTIVE"
while executing
"ACTIVE"
invoked from within
"expect {
..

Thanks in advance !

Mike
1 REPLY 1
Michele (Mike) Alberton
Regular Advisor

Re: How to intercept a "[" in an expect script ?

Hi I tried more options and found that:

"Current Mate High Availability State is \\\[ACTIVE]"

was the anwer to that pattern.

Thanks anyway !

Mike