53 lines
1.3 KiB
Bash
53 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
# 第一次要手动连入 通过下面的测试
|
|
# ** WARNING: connection is not using a post-quantum key exchange algorithm.
|
|
# ** This session may be vulnerable to "store now, decrypt later" attacks.
|
|
# ** The server may need to be upgraded. See https://openssh.com/pq.html
|
|
|
|
|
|
|
|
# C:\msys64\msys2_shell.cmd
|
|
# -mingw64 -defterm -no-start -here
|
|
|
|
|
|
ver_dir_name="v1.0.3"
|
|
dstHost="192.168.1.101"
|
|
|
|
|
|
tmp_dir="/c/Users/wyc/Desktop/version_control/tmp"
|
|
file_name="ecap_server"
|
|
|
|
srcUser="wyc"
|
|
srcHost="192.168.1.8"
|
|
src_dir="/aenv/proj/plant_sun_cat/cmake-build-ubuntu_20_04-release2"
|
|
SRC_PASS="123"
|
|
|
|
dstUser="heco"
|
|
|
|
dst_dir="/home/heco/ys_ecap_server/${ver_dir_name}"
|
|
DST_PASS="123456"
|
|
|
|
|
|
sshpass -p "123" scp -o StrictHostKeyChecking=no "${srcUser}@${srcHost}:${src_dir}/${file_name}" "${tmp_dir}"
|
|
sshpass -p "123456" scp -o StrictHostKeyChecking=no "${tmp_dir}/${file_name}" "${dstUser}@${dstHost}:${dst_dir}"
|
|
|
|
|
|
#expect
|
|
|
|
# 合并执行
|
|
#export SSHPASS=$SRC_PASS
|
|
#sshpass -e ssh "${srcUser}@${srcHost}" "cat ${src_dir}/${file_name}" | \
|
|
# sshpass -p "$DST_PASS" ssh "${dstUser}@${dstHost}" "cat > ${dst_dir}/${file_name}"
|
|
#
|
|
|
|
|
|
# 检查 SCP 命令的返回值
|
|
if [ $? -eq 0 ]; then
|
|
echo "传输成功!"
|
|
else
|
|
echo "传输失败:$?"
|
|
fi
|
|
|
|
#echo "按任意键继续..."
|
|
#read -n 1 -s |