Posted by: Anonymous
[ip: 199.172.169.7]
on September 26, 2007 05:20 PM
It's great that it solved your problem, but this Expect script could be improved.
The option -re does not mean read, it means to treat the next thing as a Regular Expression when matching against the output from the spawned program. Since you're only matching a fixed string, -re is redundant here.
The second match line is also redundant, because the clauses within an expect statement will always be matched in order and since the patterns are the same the second will never be reached. The exp_continue means to restart the same expect statement again.
Also Expect is capable of doing the whole job, without needing a shell script or gawk. Here's an (untested) example:
Expect script could be improved
Posted by: Anonymous [ip: 199.172.169.7] on September 26, 2007 05:20 PMThe option -re does not mean read, it means to treat the next thing as a Regular Expression when matching against the output from the spawned program. Since you're only matching a fixed string, -re is redundant here.
The second match line is also redundant, because the clauses within an expect statement will always be matched in order and since the patterns are the same the second will never be reached. The exp_continue means to restart the same expect statement again.
Also Expect is capable of doing the whole job, without needing a shell script or gawk. Here's an (untested) example:
For more docs see http://aspn.activestate.com/ASPN/docs/ActiveTcl/8.4/expect/expect.1.html
#