Hi,
I am using Solaris OS,
I want to handle an occasional expression in expect script while logging into a remote server with ssh.
In normal scenario the expected expression is as below,
spawn ssh $user@$ip
expect "assword:"
send "$password\r"
but in a condition when the remote server is not in the known hosts of local server, the server prompts if you want to add the remote server as known host ending with an expression (yes/no).
i have got below code to handle that condition but it is failing.
spawn ssh $user@$ip
expect "(yes/no)?"
send -- "yes\r"
expect "assword:"
send "$password\r"
can somebody suggest a better way to handle that.
As i mentioned earlier my problem is that (yes/no) expression is occasional that is whenever the remote server has got rebooted or something. Otherwise the normal password prompt comes.
Its something like, i want
if remote server prompts,(yes/no)
pass:-yes
and continue with password passing
if remote server doesn't prompt,(yes/no)
just continue with password passing
Thanks in advance.