我的简单代码有问题,期望无法期望输出
set timeout 10
set user username
set password password
spawn ssh [email protected]
expect "Password:"
send "$password\r"
expect eof
send "cv mk ghassan-test-5\r"
sleep 45
expect "ok" { send "cv set ghassan-test-5\r" }
sleep 20
expect -gl "Ok" { send "cv rbset ghassan-test-5\r" }
expect eof
sleep 20
expect -gl "Ok" { send "cv ls\r" }
sleep 10
expect eof`
send "exit\r"
脚本运行并输入到远程服务器,但在send "cv mk ghassan-test-5\r"
生成输出后,......
数据库正在写入磁盘,请稍候。写入数据库文件可能需要几分钟...好的,但是当脚本运行下一行时,expect "ok" { send "cv set ghassan-test-5\r" }
它没有运行并且没想到,ok
因为ok
但是如果我期望分钟就可以了工作正常(ok
1分钟后出现)