我需要编写脚本来将远程服务器文件复制到服务器后端的服务器上。类似如下:如何在shell脚本中从远程服务器复制文件?
#!/usr/bin/expect -f
spawn /usr/local/bin/scpdata.sh
set timeout 3000
expect "[email protected]'s password:"
set timeout 3000
send "xxxx"
set timeout 3000
send "exit\r"
expect eof
scpdata.sh文件
#!/bin/bash
scp [email protected]:/tmp/11-03-15_03:00:01.tar.gz /tmp
但这不行,哪里是问题,怎么办呢?请帮助
@ user670809:究竟是什么出了问题? scp命令? – Heisenbug 2011-03-22 08:46:18