spawn自动远程输入密码
来源:互联网 发布:minix3.3.0源码 编辑:程序博客网 时间:2024/04/30 05:42
#!/bin/bashsrc=$1dst=$2psd=$3flag=$4expect<<- ENDset timeout -1spawn rsync $flag $src $dstexpect { "(yes/no)?" { send "yes\n" expect "*assword:" { send "$psd\n"} } "*assword:" { send "$psd\n" }}expect eofENDexit 0
阅读全文