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"} } }