Reputation: 1115
Trying to automate a ssh process. The prompt I got when ssh into a host is:
ubuntu@ip-172-30-2-110:~$
My expect script
spawn ssh [email protected]
expect ":~\$ "
This will timeout while waiting for the pattern.
However, if I change the expect statement to be
expect "\$ "
it works fine (no wait).
Wonder why.
Upvotes: 1
Views: 497
Reputation: 1115
Turned out the the ":" and "~" in the prompt :~$
is colored in the terminal.
Found that the following expect statement works (it results in a match)
expect -re ":.{8}~.{5}\\\$ "
Upvotes: 2