shell脚本基础(八)
# cd /usr/local/sbin/ # ls01.expect02.expect03.expectcheck_ng.shlvs_dr.shlvs_nat.shmonnginx_log_rotate.sh
# vim 04.expect //自动同步脚本
#!/usr/bin/expect
set passwd "rootroot"
spawn rsync -av root@192.168.242.129:/tmp/12.txt /tmp/
expect {
"yes/no" { send "yes\r"}
"password:" { send "$passwd\r"}
}
expect eof
# ./04.expect
spawn rsync -av root@192.168.242.129:/tmp/12.txt /tmp/
root@192.168.242.129's password:
receiving incremental file list
12.txt
sent 30 bytesreceived 84 bytes228.00 bytes/sec
total> # ls /tmp/12.txt
/tmp/12.txt
页:
[1]