Sunday 15 September 2013

tcl - Curly brackets in Expect language "expect" command? -



tcl - Curly brackets in Expect language "expect" command? -

i new expect/tcl , wanted confirm in illustration below, curly-braces work single-quotes in bash grouping body of expect command? example:

expect { -re "(p|p)assword: " { send "$pwd\r" } -re "connection timed out" { puts "timeout error"; exit 1 } -re "connection closed" { puts "host error"; exit 1 } timeout { puts "timeout error"; exit 1 } eof { puts "connection error"; exit 1 } }

in standard tcl, that's how braces work. (ok, lots of command implementations utilize quoted thing immediately, works pretty much you'd expect.)

however, you're looking @ body of expect command. outer braces (on first , lastly line) ones guaranteed work way; others expect command — implemented in c — interpret chooses. documentation states if contents of braces multiline, they're interpreted (tcl) list, makes them work in pretty much way you're after. (as tcl commands go, that's strange, expect has worked way decades isn't change.)

tcl expect

No comments:

Post a Comment