This topic created in 2402 days ago, the information mentioned may be changed or developed.
P="sw{sdw[@><K]}" 这是密码
/usr/bin/expect<<EOF
set timeout -1
spawn bash -c "rsync -av --inplace --delete --progress \"-e ssh -p ${bills_bak_port}\" $Sdir $U@$H:$Ddir"
expect {
"(yes/no)?" {send "yes\r";exp_continue}
"password:" {send "$P\r"}
}
expect eof
EOF