Expect: invalid command name “*”

2019-08-28 21:12发布

In my Expect script this line is throwing an error:

expect "Address or name of remote host [*]? "

In the log I see this error:

switchnumber1#invalid command name "*"
    while executing
"*"
    invoked from within
"expect "Address or name of remote host [*]? ""

The remote host ip address in the brackets could change.

标签: expect
1条回答
你好瞎i
2楼-- · 2019-08-28 21:41

Expect uses Tcl. In Tcl, [...] in double quotes is the command substitution syntax which is like $(...) (or `...`) in Bash.

To include a literal [ char you could write:

expect "Address or name of remote host \[*]? "
查看更多
登录 后发表回答