Jonathan Kittell
Jonathan Kittell

Reputation: 7493

Expect: invalid command name "*"

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.

Upvotes: 0

Views: 969

Answers (1)

pynexj
pynexj

Reputation: 20688

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

Upvotes: 3

Related Questions