I have written a small expect script for automatic ssh to remote server. But sometimes my expect script don't work. Actually it sends password before password prompt. Here is my script
#!/usr/bin/expect -fset password xyzzys# now connect using sshset host [lindex $argv 0]spawn ssh vivek.gagrani@$hostexpect "*?assword:*"send -- "$password\r"send -- "\r"interactWhen running this script I see below output sometimes:
spawn ssh vivek.gagrani@bvdev429xyzzys ----> password sent before askingvivek.gagrani@bvdev429's password:How to fix this ?