The only thing I can see, is that on line 11, it should read while true {
and in your initial comment the true
is missing.
You wrote:
When running the script I get: wrong # args: should be "while test command" while executing "while { expect "Password:" { stty -echo expect_user -re "(.*)\n" send
and the code in that section should be
while true {
expect "Password:" {
stty -echo
expect_user -re "(.*)\n"
send "$expect_out(1,string)\n"
stty echo
expect "Are you OK with your IP being logged?" { send "y\n" }
} \
"Are you OK with your IP being logged?" { send "y\r" }
```
Interesting. I've not seen this error before. Can you confirm the version of expect and OS you are using? My only other thought it that line 19 "Are you OK with your IP being logged?" { send "y\r" }
is a continuation of line 18, hence line 18 must end with \
with no trailing characters.