其他分享
首页 > 其他分享> > expect 安装和简单实例

expect 安装和简单实例

作者:互联网

#!/usr/bin/expect
eval spawn scp output.zip liuyanjun@192.168.196.34:/tmp
set prompt ":|#|\\\$"
interact -o -nobuffer -re $prompt return
send "passworld\r"
interact -o -nobuffer -re $prompt return
expect eof"
      
set WildMiracleRoot /home/liuyanjun/workspace/new_project_framework/server/
eval spawn ssh -t liuyanjun@192.168.196.34 \"source .bash_profile && cd $WildMiracleRoot/frame/config/ConfigData/ && cp /tmp/output.zip ./ -f && unzip -o output.zip && cd $WildMiracleRoot/frame/ConfigSer/src/ && killall ConfigSer && sh clear.sh\"
      
interact -o -nobuffer -re $prompt return
send "passworld\r"
interact -o -nobuffer -re $prompt return
expect eof"

yum安装

       yum install  expect 

       yum install expect-devel

       yum install tcl 

 

参考:https://blog.csdn.net/supingemail/article/details/46680539

https://segmentfault.com/a/1190000003851594

 

标签:prompt,interact,nobuffer,re,实例,expect,&&,安装
来源: https://blog.csdn.net/u012662731/article/details/91859497