1.expect 关键字 send: 向进程发送字符串,用于模拟用户的输入。注意一定要加\r回车 expect: 从进程接收字符串 spawn: 启动进程(由spawn启动的进程的输出可以被expect所捕获) interact: 用户交互 2.如何向expect脚本传入参数 set <变量名称> [lindex $argv <param index>] 注意下标从0开始,即0是第一个参数,不是脚本名称,这个和shell不同 #!/usr/bin/expect set host [lindex $argv 0]