我是期待腳本的新手。在預期腳本中處理多個語句
我在linux機器上爲ssh編寫了一個期望腳本,我在不同的linux機器上面臨着sshing問題。下面我複製了腳本。
!/usr/local/bin/expect
set LinuxMachine [lindex $argv 0]
spawn ssh [email protected]$LinuxMachine
expect "[email protected]$LinuxMachine's password:"
send "root123\n"
expect "[[email protected]_FC12_172_85 ~]#"
send "ls"
interact
當我從提供的命令行預計,4號線10.213.172.85
,它讀作「[email protected]'s password:
」,成功的登錄
但是一些Linux將expect-
The authenticity of host '10.213.172.108 (10.213.172.108)' can't be established.
RSA key fingerprint is da:d0:a0:e1:d8:7a:23:8b:c7:d8:40:8c:b2:b2:9b:95.
Are you sure you want to continue connecting (yes/no)
在這案例腳本不起作用。
請讓我知道如何在一個expect命令中使用兩個expect語句。
在此先感謝!