expect_continue

#!/usr/bin/expect
spawn ssh -p portnumber root@database
expect {
 "No route" { exit }
 "want" {send -- "yes\r"; exp_continue}
 "password:" {send -- "passwd\r"}
 }
expect "]#"
send "ls -l /tmp\r"
expect "]#"
send "exit\r"
 

你可能感兴趣的:(职场,expect,休闲)