~~~
服务器IP地址
des_host=serverIp
服务器存储路径(文件上传后存储指定目录下)
des_direc=/home/lk/
服务器用户密码
des_pass=root_password
需要上传文件的路径
src_file_OpenTestClient=/Users/test/uploadFile
echo "upload file to $des_host:$des_direc"
执行上传操作
expect -c "
spawn scp $src_file_OpenTestClient root@$des_host:$des_direc
expect "password:"
send "${des_pass}\r"
expect eof
"
~~~