expect问题总结

来源:互联网 发布:windows快速锁屏 编辑:程序博客网 时间:2024/06/03 04:08
1.

在liunx下,用root登录的,这时候命令提示符是#,而其他用户登录的时候是$。

为了写个通用的,就用到正则表达式-re选项

expect "]$"

改成

expect -re "]($|#)"

2.

每个expect脚本最后都用expect eof结尾,如果用send “ls\n”结尾,就没有ls的结果显示。