lwlmj2011 发表于 2012-05-08 18:12

关于expect程序返回值的疑问

#!/bin/bash
#!/usr/local/tcl/bin       我的expect是源码编译安装,这是命令存放路径
expect -c '
spawnssh 192.168.0.89
expect {
    "(yes/no)?" {
      send "yes\n"
      expect "assword:"
      send "$pasword\n"
    }
        "assword:" {
      send "$password\n"
    }
}
'
问题:
如何判断红色部分的代码是否执行成功,如果expect命令的执行有返回值的话,怎么获取

jerrysun 发表于 2012-05-08 18:47

lwlmj2011 发表于 2012-05-08 18:12 static/image/common/back.gif
#!/bin/bash
#!/usr/local/tcl/bin       我的expect是源码编译安装,这是命令存放路径
expect -c '


你这个问题还是去shell板块问问吧,这里的朋友不是很了解,这里都是做运维的

lwlmj2011 发表于 2012-05-08 22:42

嗯好的
:))

king_819 发表于 2012-05-09 18:56

if [ $? = 0 ] ; then

...

else

...

fi

lwlmj2011 发表于 2012-05-09 19:54

expect不同于shell
没有那么简单

yue_5516 发表于 2012-05-11 20:11

记得在yes/no的后面用exp_continue
页: [1]
查看完整版本: 关于expect程序返回值的疑问