使用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