用途,如有些程序在运行时需要交互式输入密码,但你又想自动调用,这里密码传入就可用expect来实现,下面是一个简单的例子,一个朋友发给我的。
#!/usr/bin/expect
set password "0000"
spawn tmloadcf -y ubbconfig2
expect "Enter New Application Password:"
send "$password\r"
expect "Re-enter New Application Password:"
send "$password\r"
expect eof
阅读(1088) | 评论(0) | 转发(0) |