I am trying to match a text which contains the " ", from the log file. But it doesn't match. I understand that " " has got a special meaning to TCL/Expect.
Hence I tried the following, but no luck.
expect -ex {
"lp -c -demail -ot\\\"[email protected]\\\" /usr/local/spool/pf"
{
incr logged
send_user "\r\n LOGGED #4, $logged \r\n"
}
timeout
I tried to use , \ and \\ but no luck yet.
My log file contains the following line,
exec [lp -c -demail -ot"[email protected]" /usr/local/spool/pf/context/ABC001-1209236.mime]
and I need to match that line.
Use {} quotes, which are similar to shell's single quotes. Also Tcl is sensitive to newlines, so you have to put the opening brace of a block on the previous line
expect {
{lp -c -demail -ot"[email protected]" /usr/local/spool/pf} {
incr logged
send_user "\r\n LOGGED #4, $logged \r\n"
}
timeout
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With