Goldice 发表于 2013-2-4 13:29:35

分享一个expect的脚本

分享一个expect的脚本,可以用于Linux机器之间远程执行命令:
 
 
#!/usr/bin/expect -fset ipaddress set user set passwd set cmd set timeout spawn -noecho ssh $user@$ipaddress $cmdexpect {"yes/no" { send "yes\r";exp_continue}"*assword:" { send "$passwd\r";exp_continue}#"]*" { send "$cmd\r"}}#expect eof
页: [1]
查看完整版本: 分享一个expect的脚本