我正在调用一个函数,我将scp文件发送到远程服务器。但是它给出了错误。
以下功能: -
scp_files()
{
######## scp files to remote host ###############
echo "**************************************************************************"
echo " scp files to remote host .. *"
echo "**************************************************************************"
echo "value of first argument is $1"
echo "silver username is $silver_username"
expect <<- DONE
log_user 0
set timeout -1
spawn scp commands.txt $silver_username@$1:/tmp/
expect "password: "
send "test123\r"
expect "$ "
send "exit\r"
expect eof
DONE
}
scp_files ${!REDIS_IP} ${!REDIS_PORT}
这里我得到的错误如下:
发送:spawn id exp5未打开
这里的问题可能出在哪里?