expect命令问题1

[root@localhost scripts]# cat exptest.sh
#!/usr/bin/expect
spawn ssh root@127.0.0.1
expect "password: "
send "oracle\r"
sleep 1
send "ls\r"
#send "ls >/tmp/l3.log\r"
send "echo status:$?\r"
expect -re "status:(\[0-9]+)" { exit $expect_out(1,string) }
exit
send "ls\r"
interact

关键字sleep 1,不加的话后面的命令都不会执行,很纳闷

posted @ 2015-10-19 22:28  hao_xiaoyu  阅读(238)  评论(0编辑  收藏  举报