Shell分发系统
#!/usr/bin/expectset passwd "123456" ##建议用密钥,防止口令泄露
set host
set file
spawn rsync -avR --files-from=$file / root@$host:/
expect {
"yes/no" { send "yes\r"}
"password:" { send "$passwd\r" }
}
expect eof
页:
[1]