From fe12a2d5ea14865cd9e4c452438a23a90bf6b5e1 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 14 May 2024 15:19:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A#=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/scp_expect | 6 +++--- script/ssh_expect | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/script/scp_expect b/script/scp_expect index ed1ed8d..7129385 100755 --- a/script/scp_expect +++ b/script/scp_expect @@ -26,7 +26,7 @@ expect { "yes/no" { send "yes\r"; exp_continue } - "*$ " { + "*$ " | "*# " { # 从跳板机复制文件到目标主机 send "scp -P $remote_port -r $temp_file $remote_user@$remote_host:$remote_file\r" expect { @@ -34,9 +34,9 @@ expect { send "yes\r" exp_continue } - "*$ " { + "*$ " | "*# " { send "rm $temp_file\r" - expect "*$ " {send "exit\r"} + expect "*$ " | "*# " {send "exit\r"} } } } diff --git a/script/ssh_expect b/script/ssh_expect index cd37a71..62e228a 100755 --- a/script/ssh_expect +++ b/script/ssh_expect @@ -15,13 +15,13 @@ expect { "yes/no" { send "yes\r"; exp_continue } - "*$ " { + "*$ " | "*# " { send "ssh -p $remote_port $remote_user@$remote_host $ssh_cmd\r" expect { "yes/no" { send "yes\r"; exp_continue } - "*$ " {send "exit\r"} + "*$ " | "*# " {send "exit\r"} } }