Expect: invalid command name “*”

我是研究僧i 提交于 2019-12-13 03:46:39

问题


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.


回答1:


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 \[*]? "


来源:https://stackoverflow.com/questions/51883910/expect-invalid-command-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!