使用expect,进行远程拷贝
1.首先确认你的系统安装有expect
which expect
如果显示如下,说明已经安装完expect,如果没有执行2
/usr/bin/expect
2. yum install expect
3.远程拷贝代码
#!/usr/bin/expect -f
set password /{0j4jn*/{
spawn scp -r root@10.249.194.47:/usr/local/python /usr/local/python
set timeout 300
expect "root@10.249.194.47's password:"
set timeout 300
send "$password/r"
set timeout 300
send "exit/r"
expect eof
相关文章
- linux-shell命令之cp(copy)【拷贝复制】
- linux scp 服务器远程拷贝
- Linux Shell系列教程之(七)Shell输出
- linux bash shell编程之参数变量和流程控制。
- shell脚本-linux如何在脚本中远程到一台linux机器并执行命令
- Shell In A Box:一款访问远程Linux服务器的SSH终端
- Linux网络服务与shell脚本——Shell编程之条件语句
- scp命令:linux上从远程服务器拷贝文件/目录到本地服务器
- Linux常用命令(5)--SSH访问远程服务器、SCP服务器间文件拷贝
- Linux远程连接工具 Shell Xshell6 XFtp6 绿色破解免安装版